multiple core query using solrnet - solr

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

Related

How to query solr field for a substring

My use case:
I have a single-valued field called cqpath. This is a textfield and has a values that look something like the following:
"/content/domain/en/path/to/some/page"
"/content/domain/en/path/to/another/page"
"/content/domain/en-us/path/to/some/page"
"/content/domain/en-us/path/to/another/page"
I wanted to form a query that would return me 1. and 2. I'd been trying along the lines of writing:
cqpath: "/content/domain/en"
which has been discovered to be erroneous, since it retrieves items 3. and 4. as well. Could any of you think of a way to write a query that returns only 1. and 2. and not 3. and 4.?
This is a normal textfield field-type. Really do appreciate your help.
Starting from Solr 4.0 you can use a regex query. You can find some useful examples here.
In your case, you can get the results that you're looking for using something like:
cqpath:/.*content/domain/en.*/
It looks like you are trying to match partial paths here with boundaries on path elements (slashes). The usual generic solution is to tokenize during index to generate all alternative completions and not tokenize during query. So, the field type declaration is not symmetric. There are examples of that in Solr distribution. And you would look at using something like (index-time only) EdgeNGramFilterFactory instead of much more expensive regex matching.
For your specific case, you may want to look at testPathHierarchyTokenizer which does that for you automatically.
And if your content were more like full URLs than just path, you could also be interested by a custom update request processor chain that includes URLClassify URP. It is not very documented, but mentions generating url parts, which is what I think you would want.

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

Solr configuration

I'm very new with Solr,
And I really want a step by step to have my Solr search result like the google one.
To give you an idea, when you search 'PHP' in http://wiki.apache.org/solr/FindPage , the word 'php' shows up in bold .. This is the same result I want to have.
Showing only a parser even if the pdf is a very huge one.
You can use highlighting to show a matching snippet in the results.
http://wiki.apache.org/solr/HighlightingParameters
By default, it will wrap matching words with <em> tags, but you can change this by setting the hl.simple.pre/hl.simple.post parameters.
You may be looking at the wrong part of the returned data. Try looking at the 'highlighting' component of the returned data structure (i.e. don't look at the response docs). This should give you the snippets you want.

Solr multiple filter tagging / excluding

I am trying to apply filter tagging for Solr search Tagging_and_excluding_Filters.
The challenge is to apply multiple tagging at the same time (for multiple select options on a single page). e.g.
q=mainquery&fq=status:public&fq={!tag=dt}doctype:pdf&fq={!tag=doc}document:1&facet=on&facet.field={!ex=dt}doctype&facet.field={!ex=doc}document
But for some reason excluding works only for one filter and other gets unnoticed. Is there any problem with my syntax? Can anyone suggest a better method?
I'm having a similiar problem to solve and it seemed to work by just using a comma to seperate excluded tags:
From: http://wiki.apache.org/solr/SimpleFacetParameters#facet.field
Filter exclusion is supported for all types of facets. Both the tag
and ex local params may specify multiple values by separating them
with commas.
So I guess you'd use it like: {!ex=doc,dt}
This answer may not be timely, but i think this should resolve your issue.
Try adding both the tags in both the ex clauses.
I did that and it worked for me for a similar case.
q=mainquery&fq=status:public&fq={!tag=dt}doctype:pdf&fq={!tag=doc}document:1&facet=on&facet.field={!ex=dt,doc}doctype&facet.field={!ex=dt,doc}document
Possibly the http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParams section
would help you further than the from you mentioned one.
Best regards!

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