I have 8 fields in my schema. I have 2 types of documents in the index. The first type contains the details of a book and the second type of document contains where all a particular book is referenced.
The reason for such a schema is to reduce the index size. The documents in my Solr index look like this -
doc1 -
uniqueKey - <someid>
id - 1
name - Solr
author - something
isbn - something else
subject - null
referenced - null
dataType - detail
doc2 -
uniqueKey - <someid>
id - 1
name - null
author - null
isbn - null
subject - physics
referenced - 2011
dataType - reference
doc3 -
uniqueKey - <someid>
id - 1
name - null
author - null
isbn - null
subject - maths
referenced - 2013
dataType - reference
I want to let my users choose the subject and/or year but display the detail document in the result.
To achieve this I use the join
query which looks like -
q=dataType:detail&fq={!join from=id to=id}<userySelectedSubjectAndOrYear>&dataType:reference
I have to generate this query in my backend everytime; instead I would like to use default
, appends
and/or invariant
in my requestHandler
because most part of the query remains the same.
I tried to do the following in my requestHandler
<requestHandler name="/usage" class="solr.SearchHandler">
<lst name="defaults">
<int name="rows">10</int>
<str name="wt">json</str>
</lst>
<lst name="appends">
<str name="q">dataType:detail</str>
<str name="fq">{!join from=id to=id}dataType:reference</str>
</lst>
</requestHandler>
and pass the user selected subject and/or year as /usage?fq=subject:physics
I do not get any results. According to the link, it should append the values. What am I missing? Will I have to write my own custom RequestHandler
to get this?