diff --git a/include/book.h b/include/book.h
index 2baeab921..eff8a037f 100644
--- a/include/book.h
+++ b/include/book.h
@@ -59,6 +59,7 @@ class Book
const std::string& getDate() const { return m_date; }
const std::string& getUrl() const { return m_url; }
const std::string& getName() const { return m_name; }
+ std::string getCategory() const;
const std::string& getTags() const { return m_tags; }
std::string getTagStr(const std::string& tagName) const;
bool getTagBool(const std::string& tagName) const;
diff --git a/src/book.cpp b/src/book.cpp
index beb3b5eba..f7f284036 100644
--- a/src/book.cpp
+++ b/src/book.cpp
@@ -220,4 +220,16 @@ bool Book::getTagBool(const std::string& tagName) const {
return convertStrToBool(getTagStr(tagName));
}
+std::string Book::getCategory() const
+{
+ try
+ {
+ return getTagStr("category");
+ }
+ catch ( const std::out_of_range& )
+ {
+ return "";
+ }
+}
+
}
diff --git a/src/opds_dumper.cpp b/src/opds_dumper.cpp
index ef4c8dd03..8f14e0949 100644
--- a/src/opds_dumper.cpp
+++ b/src/opds_dumper.cpp
@@ -77,6 +77,7 @@ pugi::xml_node OPDSDumper::handleBook(Book book, pugi::xml_node root_node) {
ADD_TEXT_ENTRY(entry_node, "updated", gen_date_from_yyyy_mm_dd(book.getDate()));
ADD_TEXT_ENTRY(entry_node, "name", book.getName());
ADD_TEXT_ENTRY(entry_node, "flavour", book.getFlavour());
+ ADD_TEXT_ENTRY(entry_node, "category", book.getCategory());
ADD_TEXT_ENTRY(entry_node, "tags", book.getTags());
ADD_TEXT_ENTRY(entry_node, "articleCount", to_string(book.getArticleCount()));
ADD_TEXT_ENTRY(entry_node, "mediaCount", to_string(book.getMediaCount()));
diff --git a/src/wrapper/java/book.cpp b/src/wrapper/java/book.cpp
index 2d555f3b7..157cc5251 100644
--- a/src/wrapper/java/book.cpp
+++ b/src/wrapper/java/book.cpp
@@ -69,6 +69,7 @@ GETTER(jstring, getDate)
GETTER(jstring, getUrl)
GETTER(jstring, getName)
GETTER(jstring, getFlavour)
+GETTER(jstring, getCategory)
GETTER(jstring, getTags)
GETTER(jlong, getArticleCount)
GETTER(jlong, getMediaCount)
diff --git a/src/wrapper/java/org/kiwix/kiwixlib/Book.java b/src/wrapper/java/org/kiwix/kiwixlib/Book.java
index c40cd1670..693e83375 100644
--- a/src/wrapper/java/org/kiwix/kiwixlib/Book.java
+++ b/src/wrapper/java/org/kiwix/kiwixlib/Book.java
@@ -24,6 +24,7 @@ public class Book
public native String getUrl();
public native String getName();
public native String getFlavour();
+ public native String getCategory();
public native String getTags();
/**
* Return the value associated to the tag tagName
diff --git a/test/server.cpp b/test/server.cpp
index 5e1d52e91..dc09c28b6 100644
--- a/test/server.cpp
+++ b/test/server.cpp
@@ -635,6 +635,7 @@ std::string maskVariableOPDSFeedData(std::string s)
" 2020-03-31T00:00::00Z\n" \
" wikipedia_en_ray_charles\n" \
" \n" \
+ " jazz\n" \
" unittest;wikipedia;_category:jazz;_pictures:no;_videos:no;_details:no;_ftindex:yes\n" \
" 284\n" \
" 2\n" \
@@ -658,6 +659,7 @@ std::string maskVariableOPDSFeedData(std::string s)
" 2020-03-31T00:00::00Z\n" \
" wikipedia_en_ray_charles\n" \
" \n" \
+ " wikipedia\n" \
" unittest;wikipedia;_category:wikipedia;_pictures:no;_videos:no;_details:no;_ftindex:yes\n" \
" 284\n" \
" 2\n" \