How to set facet method in SolrJ? - solr

How to set facet.method=enum in SolrJ SolrQuery? I am looking for something like solrQuery.setFacetMethod(SOLR_FACET_METHOD.enum)

I think you will need to use the generic setParam method since it is not exposed directly.
solrQuery.setParam(FacetParams.FACET_METHOD, FacetParams.FACET_METHOD_enum)

Related

How to filter Solr MoreLikeThis Result

I have query in MoreLikeThis Component, like this :
/mlt?q=5a25300cc1cb1786198b4571&df=id&fl=*,score&fq=service:2&mlt=true&mlt.fl=pagetext&mlt.mintf=3&mlt.mindf=3&mlt.minwl=3&mlt.maxwl=15&mlt.boost=true&mlt.count=10
My question is : Can i filter this MoreLikeThis result, something like mlt.fq, where in example mlt.fq=type:vehicle than i'll only get moreLikeThis result from document with type:vehicle only. Like fq for Search Component but instead i use it for MoreLikeThis Component. If i use fq=type:vehicle, its possible that i wont get result because document with id:5a25300cc1cb1786198b4571 have other type(not vehicle).
NB: mlt.fq is not exist. Its just for convenient in my questions.
NB: i cant use mlt.qf for this, because mlt.qf is for something like scoring the similarity, or can i? :)
My Solution : create my own handler and component
In MoreLikeThisComponent, edit search request so it can include params mlt.fq(my new param).
I dont know if its a bad or good solution, but its what i need and it works.

Adding raw query parameters via Criteria API

I could not find an answer to this. I found the previous similar question unanswered. I'd like to use Spring data solr for queries. But #Query is insufficient for my needs. As I understood, whatever you give here becomes a q parameter to `select' handler of solr.
In my case I need to add more parameters for example sfield for a spatial search. If #Query wont cut it, I am ready to write a custom repository implementation by autowiring SolrTemplate, But then the Criteria API does not seem to let me add a raw query parameter either.
Any help/points will be greatly appreciated.
I worked around it by creating a QueryParser decorator that adds the required parameters to a parsed solr query. The QueryParser was registered using solrTemplate.registerQueryParser().
Note however that I had to do a really nasty hack to get this working, since all queries that are sent to solrTemplate.queryForPage are wrapped by a static package protected inner class in QueryBase. So my registration code above had to be in a package org.springframework.data.solr.core

org.apache.cxf.staxutils.DepthExceededStaxException caused by innerElementCountThreshold:50000

I am using apache cxf 2.6.10, and while processing a call I always get DepthExceededException. The documentation says I can override these values, but how can I do that? I tried defining those property in the bean it does not work. I tried setting them in cxf:bus it does not works.
Any idea?
I solved this by increasing value of static field innerElementCountThreshold. I set it in my code like this:
StaxUtils.setInnerElementCountThreshold(200000);

multiple core query using solrnet

Im basically trying to achieve the following:
q=MyField0:ValueA
AND
{!join from=OtherID1 to=MainID fromIndex=Index2 v='(MyField1:ValueB)'}
AND
{!join from=OtherID2 to=MainID fromIndex=Index3 v='(MyField2:ValueC)'}
So I'm basically joining with two other cores. Is there any way to achieve this through SolrNet?
I've had a look at the ExtraParams in QueryOptions but I'm not getting too far.
I can create the seperate joins using a LocalParamsQuery object with a modified serializer but I've no idea as to how to put this all together to achieve the above.
Any ideas?
You would just put all that text is as your "q" parameter, which from what I can tell is the first example in the SolrNet documentation. I've not actually used SolrNet myself.
https://github.com/mausch/SolrNet/blob/master/Documentation/Querying.md

Index-time boosting using DIH with JdbcDataSource

Is it possible to add boosts to docs and fields in Solr 1.4 DIH when using a JdbcDataSource? The documentation seem to suggest it's possible but I can't find any examples.
There are a few examples of how to add the boost="2.0" attribute to your docs/fields in XML imports, but how do you do the same with the JdbcDataSource?
The closest I could get to an answer was http://www.nabble.com/data-import-handler---going-deeper...-td20731715.html
Add a special value $fieldBoost. to the row map
Has this been implemented yet?
$fieldBoost is not implemented, but $docBoost is.
Source code.
Special commands docs.
This is not an answer, If you want to change the score of the field or the document you have added
http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
just go through above link

Resources