The first output is from the query component. You might just need to
make the collapse component first and remove the query component
completely.
We perform geographic searching with localsolr first (if we need to),
and then try to collapse those results (if collapse=true). If we
don't have any results yet, that's the only time we use the standard
query component. I'm making sure we set the
builder.setNeedDocSet=false and then I modified the query component to
only execute when builder.isNeedDocSet=true.
In the field collapsing patch that I'm using, I've got code to remove
a previous 'response' from the builder.rsp so we don't have duplicates.
Now, if I could get field collapsing to work properly with a docSet/
docList from localsolr and also have faceting work, I'd be golden.
Doug
On Dec 9, 2008, at 9:37 PM, Stephen Weiss wrote:
Hi Tracy,
Well, I managed to get it working (I think) but the weird thing is,
in the XML output it gives both recordsets (the filtered and
unfiltered - filtered second). In the JSON (the one I actually use
anyway, at least) I only get the filtered results (as expected).
In my core's solrconfig.xml, I added:
<searchComponent name="collapse"
class="org.apache.solr.handler.component.CollapseComponent" />
(I'm not sure if it's supposed to go anywhere in particular but for
me it's right before StandardRequestHandler)
and then within StandardRequestHandler:
<requestHandler name="standard" class="solr.StandardRequestHandler">
<!-- default values for query parameters -->
<lst name="defaults">
<str name="echoParams">explicit</str>
<!--
<int name="rows">10</int>
<str name="fl">*</str>
<str name="version">2.1</str>
-->
</lst>
<arr name="components">
<str>query</str>
<str>facet</str>
<str>mlt</str>
<str>highlight</str>
<str>debug</str>
<str>collapse</str>
</arr>
</requestHandler>
Which is basically all the default values plus collapse. Not sure
if this was needed for prior versions, I don't see it in any patch
files (I just got a vague idea from looking at a comment from
someone else who said it wasn't working for them). It would kinda
be nice if someone working on the code might throw us a bone and say
explicitly what the right options to put in the config file are (if
there are even supposed to be any - for all I know, this is just a
bandaid over a larger problem). I know it's not done yet though...
just a pointer for this patch might be handy, it's really a useful
feature if it works (I was kinda shocked this wasn't part of the
standard distribution since it's something I had to do so often with
mysql, kinda lucky I guess that it only came up now).
Another issue I'm having now is the faceting doesn't seem to change
- even if I set the collapse.facet option to "after"... I should
really try "before" and see what happens.
Of course, I just realized the integrity of my collapse field is not
so great so I have to go back and redo the data :-)
Best of luck.
--
Steve
On Dec 9, 2008, at 7:49 PM, Tracy Flynn (SOLR) wrote:
Steve,
I need this too. As my previous posting said, I adapted the 1.2
field collapsing back at the beginning of the year, so I'm somewhat
familiar.
I'll try and get a look this weekend. It's the earliest I''m likely
to get spare cycles. I'll post any results.
Tracy
On Dec 9, 2008, at 4:18 PM, Stephen Weiss wrote:
Hi,
I'm trying to use field collapsing with our SOLR but I just can't
seem to get it to do anything.
I've downloaded a dist copy of solr 1.3 and applied Ivan de
Prado's patch - reading through the source code, the patch
definitely was applied successfully (all the changes are in the
right places, I've checked every single one).
I've run ant clean, ant compile, and ant dist to produce the war
file in the dist/ folder, and then put the war file in place and
restarted jetty. According to the logs, jetty is definitely
loading the right war file. If I expand the war file and grep
through the files, it would appear the collapsing code is there.
However, when I add any sort of collapse parameters (I've tried
any combination of collapse=true collapse.field=link_id
collapse.threshold=1 collapse.type=normal collapse.info.doc=true),
the result set is no different from normal query, and there is no
collapse data returned in the XML.
I'm not a java developer, this is my first time using ant period,
and I'm just following basic directions I found on google.
Here is the output of the compilation process:
I really need this patch to work for a project... Can someone
please tell me what I'm missing to get this to work? I can't
really find any documentation beyond adding the collapse options
to the query string, so it's hard to tell - is there an option in
solrconfig.xml or in the core configuration that needs to be set?
Am I going about this entirely the wrong way?
Thanks for any advice, I appreciate it.
[ sorry if you get this twice, I accidentally sent first from the
wrong e-mail address and I don't think it went through ]
--
Steve