(Lucene/SOLR) Can I annotate the results of a query based on grouping by subqueries? -


i group results of query in terms of "categories".

"categories" keyword queries, cannot pre-defined @ index time, since evolve , change on time.

more specifically:

i have set of categories defined queries q1,q2,...qn.

given user query (q), need return top resulting docs (d1,...d10) usual,

but need know if belong or not each of groups q1,...qn.

as understand i use grouping queries, has 2 drawbacks:

  1. i change results, since instead of d1,...d10 top docs each query
  2. i loose original ordering of results

the solution can think of right issue first q results , ordering, each of q , q1, q , q2, etc. grouping, parse results , group outside query... expensive!

any ideas how can need?

you can use normal way query, , add pseudo-fields in fl param matches clipping against categories using function queries.

http://solr.pl/en/2011/11/22/solr-4-0-new-fl-parameter-functionalities-first-look/ https://cwiki.apache.org/confluence/display/solr/function+queries

example:

fl=category1:sum(0.0, query($q1))

q1={!dismax}your query 1

fl=category2:sum(0.0, query($q2))

q2={!dismax}your query 2


Comments

Popular posts from this blog

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -