On Mon, Sep 14, 2009 at 10:49 AM, dharhsana <rekha.dharsh...@gmail.com>wrote:

>
>
> This is my coding where i add fileds for blog details to solr,
>
>  SolrInputDocument solrInputDocument = new SolrInputDocument();
>  solrInputDocument.addField("blogTitle","$Never Fails$");
>  solrInputDocument.addField("blogId","$Never Fails$");
>  solrInputDocument.addField("userId",1);
>
> This is my coding to add fileds for post details to solr..
>
> solrInputDocument.addField("blogId","$Never Fails$");
> solrInputDocument.addField("postId","$Never Fails post$");
> solrInputDocument.addField("postTitle","$Never Fails post$");
> solrInputDocument.addField("postMessage","$Never Fails post message$");
>
> While i am quering it from solr, this is my coding..
>
>
>  SolrQuery queryOfMyBlog = new SolrQuery("blogId_exact:Never Fails");
>         queryOfMyBlog.setFacet(true);
>         queryOfMyBlog.addFacetField("blogTitle_exact");
>         queryOfMyBlog.addFacetField("userId_exact");
>         queryOfMyBlog.addFacetField("blogId_exact");
>         queryOfMyBlog.setFacetMinCount(1);
>         queryOfMyBlog.setIncludeScore(true);
>
>
You are indexing "$Never Fails$" into the field so you should search for the
same. You don't need to add $ for exact searches on a string type field so
you can just index "Never Fails". Also, to make it a exact phrase search
enclose the query with quotes e.g. blogId_exact:"Never Fails"


-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to