Checking if two fields have same value in solr for a document - solr

I have a huge solr index.I want to find all the documents which have same value in two different fields of a SolrDocument.
Is it possible through solr query?
For example,
if sn1,sn2 are two fields in solr schema. I am interested in finding all results where values in sn1 and sn2 are equal.

Related

Querying Solr multiple indexes with different schema in single query

We have a situation where we are keeping two indexes with different schemas.
For example: suppose we have an index for seller where the key value is seller id and other attributes are seller information. Now another index is book where book id is unique key and it keeps book related information.
Is it possible to query both these indexes in a single query and get collective results?
I have checked Solr but as per my findings we can do this through distributed search in Solr but it works on same kind of schema being distributed in at max 3 indexes.
I am a newbie to Solr so please ignore if this is a stupid question.
You need to think about what makes sense for a search query but there are some rules.
The first requirement is that the unique keys need to have the same name and be unique across collections or Solr cannot collate results.
If you are then hoping to get some kind of sensible ranking of your results you need some common fields. For example I have two collections: one of product data and one containing product related documents. I have a unique key: id and I have common title and contents fields for when I want to query across the two collections. I also have an advanced search interface where I can query on specific fields like product id.
A "unification core" is a typical way of handling search across two or more cores, see this Stack Overflow answer on how to set that up
Query multiple collections with different fields in solr
Other techniques are to use federated search with something like Carrot or to issue two queries and show the results in different tabs in the search results.

Get possible facet fields with search results

I'm working on improving search which is powered by solr for my e-commerce project. So search queries are performed into Solr and results are returned by Solr.
This is working fine. Now I need to offer a facet on the search results. The first could be category this is easy to implement as Category is common to all product and in the query I make I just enable facet and pass category as facet field.
However, for different nature of products there could be different products and they have few facets defined for them.
I'm clueless as how would I know them in advance and pass it in solr search query? Does solr return all facet field by some queries along with the search results? If yes, how?
If no, then what could be the correct way to proceed further.
Pass all Unique Facet Field Name on which you want to make facet filtering, and you will get all records that have facet field.
Define all the static fieldnames in your facet query search, if there are no hits you will not get any results back for that field.
Pass all the possible fields(on which u need faceting) in Facet Field with facet.mincount=1.. so, you'll get only those fields which has at-least one occurrence in your solr data
http://<hostname>:<portname>/solr/<core_name>/select?q:<fieldname>:<value>&fq=<field_name>:<value>&fl=<field1>,<field2>,<fieldn>&start=0&rows=10&facet=true&facet.field=<field1>&facet.field=<field2>&facet.field=<fieldn>&facet.mincount=1

Is there any way to convert a solr multifield value to single field for sort?

I have records that have multiple values so I put those fields in a multifield value for its solr document. The issue is I also need to return an ordered list of these values. I have way to many records to pull all document values and sort myself. I tried to create separate solr documents to store just these values with needed information but managing this has become a nightmare. Attempting to keep comments low and managing memory has not been ideal for this solution.
Is there anyway to copy these multifield values into single field values for the same document and sort on these multiple single field values in solr?
Thanks for any help.
doesn't faceting help you? you won't need to have a copyfield for multivalued/non-multivalued, just store them in a multivalued field, facet them and set the sorting criteria for the facet (default: number of occurrencies for each value)

Solr MultiValued scoring boost with search based on array

First, I'm fairly new to solr and I'm far from sure that solr is the right solution
to solve this problem. The documents that I'm working on is already there so, if solr can solve it, then it would be great :)
One of our fields in a document is of type string and have attribute multiValued set to true. It contains a list of id's that the current document relates to.
The task a head now is that I know have a second list of id's (same domain) and, if any of these id's matches (if more then one id matches then I want a higher score), then I would like to boost the score of the document.
Use Boost Query if you are using dismax or edismax.
For example, bq=id:1 OR id:2 OR id3 will boost documents which have at least one of the 3 ids. It will also give a higher boost to documents with more matching ids.

Is there a way to subfacet a table which has been already “faceted”?

I have a table on which I'm applying a customized facet in order to find duplicates (on a column). Now I'd like to apply a new facet (on another column) on the table with the facet.
Is that possible? It seems that it can be used only one facet per time, and not combined ones together.
Cheers,
elisa
Facets can be combined on the same column or on multiple one to narrow down your data.
When you facet on two different column in the same time, result are a combination of: facet 1 AND facet 2. So in you case it will be within your duplicate records, records that match the criteria of your second facet.
You can also combine facet within the same column to create. You can read more about faceting here: http://googlerefine.blogspot.ca/2011/09/use-google-refine-to-navigate-data.html

Resources