SolrNet query filtered by specific field - solrnet

I can't seem to find anything online that allows me do this. Basically I'm doing a simple SolrQuery but I want to only get back results where a field is a specific value.
So to be more specific I want to execute a Solr Query where field is either A or B or C - Is this possible?
I think I'm going to need to do a SolrQueryByField joined with a SolrMultipleFilterQuery but not really sure of how to get about doing this.
Can anyone help or point me in the right direction?

add values in list<IsolrQuery> OredData ex: OredData.add(new solrQueryByField("field","A")) and add rest of ur choices ,then add it to solrMultipleCriteriaQuery(OredData,"OR") and choose "OR" as showed , then ,call ur Query passing solrMultipleCriteriaQuery(OredData,"OR") to it.
hope that i helped ;)

Related

Can I write a query that will bring me logs with unique identifier (Graylog)?

I just started working with graylog and I have some issues.
Can I write a query that will bring me logs with unique identifier?
For examples I have logs with op_id and loan_amt and I want to get sum of loan_amt from all logs. Here comes the problem : some logs may share same op_id and my sum will not be correct because will add plenty times the loan_amt from logs with same op_id
Can you help me, please?
If I understand correctly you will need to further narrow down your search criteria to filter out duplicate log entries.
You can use the GrayLog search query language to do this.
Try to find fields where duplicate logs differentiate from each other and then create a filter to exclude one from your results.
For example something like this:
source:hostname.that.logs.loans_amt AND LoggerName:your.logger.that.logs.loan_amt

how to get most popular results first in elastic-search

I'm learning elastic search,
I wanted to ask if there is any way to get most searched results first,
like:
by altering the documents and updating a value of em with scores,
using some kind of formula or something else
thanks community :)
You don't have that out of the box but you can indeed modify a document and increase the number of views when a user clicks on a result then use that field as part of the score (function_score might help for this).

ElasticSearch: A way to know which term hit in which field?

there are usecases where I really would like to know which term was matched in which field by my search. With this information I would like to disclose the information which field caused the hit to the user on my webpage. I also would like to know the term playing part in the hit. In my case it is a database identifier, so I would take the matched term - an ID - get the respective database record and display useful information to the user.
I currently know two ways: Highlighting and the explain API. However, the first requires stored values which seems unnecessary. The second is meant for debugging only and is rather expensive so I wouldn't want it to run with every query.
I don't know another way which is confusing: The highlighting algorithms need the information I want to use anyway, can't I just get it somehow?
On a related note, I would also be interested in the opposite case: Which term did not hit at all? This information would allow for features like "terms that didn't match your query" like Google does sometimes (where the respective words are shown in grey-strikeout).
Thanks for hints!

GSA Search - query syntax

I am trying to create a query for GSA Search:
The query suppose to bring all the results that exclude some texts inside meta tag, some thing like:
inmeta:Education -first and -second and -courses...
But no luck with that. Is anybody knows what the right syntax is?
I have used the equal to condition before and the query looks like this -
(inmeta:education=first OR inmeta:education=second)
If your results must not include all the pages with the meta tag Education not equal to the value first then use -
inmeta:Education-first
For multiple values you can use the OR condition -
(inmeta:Education-first OR inmeta:Education-second)
You can find a lot more information here -
https://developers.google.com/search-appliance/documentation/46/xml_reference#request_query_terms
Hope this helps you.

How to filter results based on order in Solr?

I need to facet inside n documents which are selected like
... ORDER BY something DESC LIMIT 100
Is that possible with Solr? How?
this is a total hack, but here goes...
do your initial query, and get your results back.
construct a new query, like so:
http://localhost:8080/solr/select/?q=id%3A123+OR+id%3A456...(keep OR-ing them up)...&facet=true&facet.field=something
where you concatenate all of your ids to a new query using OR. then, when you facet on your field, the facet summary will only apply to the results.
AFAIK no, that's not supported / implemented. Facets aren't really meant to be "stats" but a guidance to the end-user. Picture yourself browsing a faceted interface and seeing facets change whenever you change sort order or paging. Faceted browsing would be useless if it worked like that.
I think this would be a nice feature for the StatsComponent though.
I think this is possible with results grouping (now in trunk!):
http://wiki.apache.org/solr/FieldCollapsing
... the only problem is that you can set only one 'facet.field' (i.e. group.field)
But the great thing is that you get scored facets!

Resources