Extra Node in response

105 views
Skip to first unread message

rafi

unread,
Aug 16, 2011, 1:21:12 PM8/16/11
to SolrNet
Is there a way to map extra node from response ? I have an extra node
called pseudofacets. How can I get that in solrnet results:

<response>
<lst name="responseHeader">...</lst>
<result name="response" numFound="" start="0"/>
<lst name="facet_counts">...</lst>
<lst name="pseudofacet">...</lst>
</response>

Thanks,
-Rafi

Mauricio Scheffer

unread,
Aug 16, 2011, 4:46:40 PM8/16/11
to sol...@googlegroups.com
There's no good way to do that at the moment.
You can write and plug a ISolrResponseParser to parse that but SolrQueryResults is not extensible.
May I ask what the pseudofacets are?

--
Mauricio




--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To post to this group, send email to sol...@googlegroups.com.
To unsubscribe from this group, send email to solrnet+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/solrnet?hl=en.


rafi

unread,
Aug 16, 2011, 5:38:27 PM8/16/11
to SolrNet
I will have to modify solrnet source then. Perhaps, I can do it in
away others can find it useful. What are your recommendations?

psuedofacets are just just extra facets that we custom built because
of complexity of our data..

On Aug 16, 1:46 pm, Mauricio Scheffer <mauricioschef...@gmail.com>
wrote:

Mauricio Scheffer

unread,
Aug 16, 2011, 6:37:13 PM8/16/11
to sol...@googlegroups.com
I really can't think of any good way to do this. 

You could override the default implementation of ISolrQueryResultParser<T> and return a different implementation of ISolrQueryResults<T> (instead of SolrQueryResults<T>) which would contain the additional information. But then to retrieve it in your application you'd have to downcast ISolrQueryResults<T> to your results type.

Another option would be exposing the response xml directly in ISolrQueryResults<T>, which IMHO is even uglier.

Yet another approach would be exposing something like a IDictionary<string, object> in ISolrQueryResults<T> , and then each ISolrResponseParser<T> has a chance to put "something" into that dictionary, which can be later retrieved in the application. However, since this must be general, it can't be really typed.

Bottom line: I don't really like any of these options. If I had to choose one though, I'd probably go with the first one.

Thoughts?

--
Mauricio

rafi

unread,
Aug 17, 2011, 2:02:58 PM8/17/11
to SolrNet
Ended up creating new parser for it:
public class PsuedoFacetParser<T> : ISolrResponseParser<T>
where I added it to facet field:
results.FacetFields.Add(field, c);

Initialized it like so:

Startup.Container.Register<ISolrResponseParser<RentalSolrDoc>>(typeof(PsuedoFacetParser<MyDoc>).FullName,
c => new PsuedoFacetParser<MyDoc>());

What do you think?

On Aug 16, 3:37 pm, Mauricio Scheffer <mauricioschef...@gmail.com>
wrote:

Mauricio Scheffer

unread,
Aug 17, 2011, 2:07:57 PM8/17/11
to sol...@googlegroups.com
Sounds good. Just make sure it doesn't conflict with the real facet fields ;-)

Cheers
Mauricio
Reply all
Reply to author
Forward
0 new messages