2

I'm using Open Search Server on a Linux box. Everything is running well except that the number of facet results for any search seems to be limited to the number of documents in my index, which is not correct.

I'm indexing users, and users have tags. There are currently 2 users in my database, and they are tagged with 5 different tags. However, if I run a search that returns both users, only 2 different tags are returned as facets (there should be 5). If I then add a 3rd user to my index (and the new user has 0 tags) my search will return 3 tags as facets.

As far as I can tell, this is only a problem with facets. I am able to filter successfully on any of the 5 tags, and I can search successfully on the text of all 5 tags.

My index:

user_1  |  tag_1, tag_2, tag_3, tag_4
user_2  |  tag_2, tag_4, tag_5

Search for "":

Results:
  user_1
  user_2

Facets Actually Returned:
  tag_1 (1)
  tag_2 (2)

Facets That Should Be Returned:
  tag_1 (1)
  tag_2 (2)
  tag_3 (1)
  tag_4 (2)
  tag_5 (1)

Search for "tag_5":

Results:
  user_2

Facets Actually Returned:
  tag_1 (0)
  tag_2 (1)

Facets That Should Be Returned:
  tag_1 (0)
  tag_2 (1)
  tag_3 (0)
  tag_4 (1)
  tag_5 (1)

Has anyone encountered this before? Have suggestions?

Edit: Should have mentioned, multivalued is set to yes on the facet.

J. Byers
  • 33
  • 4

1 Answers1

0

OpenSearchServer knows two ways to compute facets. "Single valued method" and "Multivalued method".

Edit your search request and set "Multivalued" to "yes".

enter image description here

There is also two implementations for multivalued fields. One uses the "TermDocs" features, the other one uses the "TermVectors".

https://github.com/jaeksoft/opensearchserver/blob/master/src/main/java/com/jaeksoft/searchlib/facet/Facet.java

To test the one based on TermVectors you have to enabled the TermVector (set it to Yes) on your faceted field and index again the data.

Emmanuel Keller
  • 3,384
  • 1
  • 14
  • 16
  • Thanks, that is a good guess but I'm already setting multivalued to yes on the facet. – J. Byers Mar 31 '16 at 16:24
  • Ok. I just edit the answer by adding the instructions how to use the TermVector based implementation of multivalued faceting. May be the "TermDocs" is buggy.. (I am investigating this point..) – Emmanuel Keller Apr 01 '16 at 11:45
  • 1
    Yep. Using TermVector fixed it. To anyone who comes across this later: TermVector can be set in the index Schema. – J. Byers Apr 01 '16 at 19:11