Re: Can't limit return fields in custom request handler
Thank you very much Chris. Regards. On Mon, Jul 13, 2009 at 4:30 AM, Chris Hostetter hossman_luc...@fucit.orgwrote: : Query filter = new TermQuery(new Term(inStores, true)); that will work if inStores is a TextField or a StrField and it's got the term true indexed in it ... but if it's a BoolField like in the example schema then the values that appear in the index are T and F When you write custom Solr plugins You *HAVE* to leverage the FieldType of fields you deal with when building queries programaticly. this is what the FieldType.toInternal method is for. -Hoss -- Osman İZBAT
Re: Metada document for faceted search
Thank you Chris. I've find out how to implement my faceted search. I don't index any metadata document but i create my in-memory faceting data structure from database at my request handlers init method. Compute facet count on any request and wrrite to response as NamedList of NemedLists. Regards. On Fri, Jul 10, 2009 at 12:01 AM, Chris Hostetter hossman_luc...@fucit.orgwrote: : : I'm trying to implement custom faceted search like CNET's : approach. http://www.mail-archive.com/java-u...@lucene.apache.org/msg02646.html : . : But i couldn't figure out how to structure and index category metadata : document. The short answer: however you want For CNET, we already had a pretty robust datamodel for expressing category based attributes and how to filter products in those categories by sets or ranges of values and what labels to put on those filters, and what order to display those filters as constraints in the UI ... all i did was come up with a syntax for the metadatadocs that let me express that existing data, and then write a request handler that knew how to parse those metadata docs and interpret the existing filter syntax and convert it into a Lucene Query. AS i've mentioned before: theres nothing special about putting this metadata into a doc in your solr index -- i just did it that way so that the solr index would be entirely self contained (for replication and backup) and refreshing my in memory models would be easy using the cache warming hooks of Solr Caches. -Hoss -- Osman İZBAT
Re: Can't limit return fields in custom request handler
II'll look SolrPluginUtils.setReturnFields. I'm running same query : http://localhost:8983/solr/select/?qt=cfacetq=%2BitemTitle:nokia%20%2BcategoryId:130start=0limit=3http://localhost:8983/solr/select/?qt=cfacetq=%2BitemTitle:nokia%20%2BcategoryId:130start=0limit=3fl=id I get none empty result when filter parameter is null, but when i pass inStores filter parameter to getDocListAndSet i get empty result. SolrParams solrParams = req.getParams(); Query q = QueryParsing.parseQuery(solrParams.get(q), req.getSchema()); Query filter = new TermQuery(new Term(inStores, true)); DocListAndSet results = req.getSearcher().getDocListAndSet(q, (Query)filter, (Sort)null, solrParams.getInt(start), solrParams.getInt(limit)); Thanks. On Tue, Jul 7, 2009 at 11:45 PM, Chris Hostetter hossman_luc...@fucit.orgwrote: : But I have a problem like this; when i call : http://localhost:8983/solr/select/?qt=cfacetq=%2BitemTitle:nokia%20%2BcategoryId:130start=0limit=3fl=id , : itemTitle : i'm getiing all fields instead of only id and itemTitle. Your custom handler is responsible for checking the fl and setting what you want the response fields to be on the response object. SolrPluginUtils.setReturnFields can be used if you want this to be done in the normal way. : Also i'm gettting no result when i give none null filter parameter in : getDocListAndSet(...). ... : DocListAndSet results = req.getSearcher().getDocListAndSet(q, : (Query)null, (Sort)null, solrParams.getInt(start), : solrParams.getInt(limit)); ...that should work. What does your query look like? what are you passing for the start and limit params (is it possible you are getting results, but limit=0 so there aren't any results on the current page of pagination?) what does the debug output look like? -Hoss -- Osman İZBAT
Can't limit return fields in custom request handler
Hi. I'm writing my custom faceted request handler. But I have a problem like this; when i call http://localhost:8983/solr/select/?qt=cfacetq=%2BitemTitle:nokia%20%2BcategoryId:130start=0limit=3fl=id, itemTitle i'm getiing all fields instead of only id and itemTitle. Also i'm gettting no result when i give none null filter parameter in getDocListAndSet(...). public class MyCustomFacetRequestHandler extends StandardRequestHandler { public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { try { SolrParams solrParams = req.getParams(); Query q = QueryParsing.parseQuery(solrParams.get(q), req.getSchema()); DocListAndSet results = req.getSearcher().getDocListAndSet(q, (Query)null, (Sort)null, solrParams.getInt(start), solrParams.getInt(limit)); ... Regards. -- Osman İZBAT
Metada document for faceted search
Hi. I'm trying to implement custom faceted search like CNET's approach.http://www.mail-archive.com/java-u...@lucene.apache.org/msg02646.html . But i couldn't figure out how to structure and index category metadata document. Thanks. -- Osman İZBAT