How to get all solr field names after filter is applied? - solr

There is an answer how I can get all solr fields names with curl
https://stackoverflow.com/a/29546298/5165781
So, do get all fields names I do
select?q=*:*&wt=csv&rows=0&facet
But how can I get fields names after I apply a filter?
For example:
if I want all solr fields names for specific date, I try : select?q=*:*&fq="dt":"2016-10-06T00:00:00Z"&wt=csv&rows=0&facet
But it returns all field names across all documents.
So, how can I retrieve fields names with specific filters?

Related

Is it possible to query on Solr Alias with different schema collections?

I am using SolrCloud, version 8.1.1 and I have an Alias under which there are several collections, but not all of them have the same xml schema.
So I have collection "a" which has the field "is_a" and collection b which does not have this field.
Is it possible to make a query that provides a check on the "is_a" field only for the documents in collection "a"?
If I perform the query on the Alias, I get the error:
Undefined field: is_a
The error is expected as the field name is not available in another collection.
In short you cannot perform the same query on alias until and unless you have common schema defined or you need to have the name common searchable fields in he schema which is applicable/available in all the collection.
Another alternative could be create a copy field which will hold the common searchable fields. And while using alias you can search on that copy field which is holding all the searchable field required for your application.

Solr query searching on non-indexed fields

Solr version 6.1.0
Created a schema with some fields as indexed=true on which I specifically want the solr main-query q to search.
And also added more fields, which I just wanted to select, so marked them as stored=true and indexed=false.
Issue now is that, main query q=India is searching on non-indexed fields like country, which I have specified in the image.
See the result below
It is selecting the non-indexed field only when I specify the full value of non-indexed field.
See result for q=Indi
How can I restrict solr from searching on non-index fields?
According to the screenshot above you're copying the content sent to the field country into the field _text_. When you're not giving Solr a specific field to search (i.e. you're not using one of the dismax handlers with qf or not prefixing your term with the field name field:value), it falls back to the default search field. This is set to _text_ by default. This field is indexed, and since you're copying the content from your country field into the _text_ field, the values from country will give a hit.
If you don't want this to happen, don't copy the content from country into _text_, or give Solr the actual field you want to search.

Facets in SOLR using text not in document

I am indexing word document files in Apache SOLR and would like to use facets. Using Velocity, I'm able to use the facet fields and queries which appear as part of document meta data. I'm interested in using fields which are not part of Meta data as facet fields. Ex: Name is a field that does not appear in the document but I would like to use that as facet field. So what I would get is Facet field Name under which I'll have names like John, Bridget etc along with details of the number of documents in which these names (John, Bridget) appear. Please let me know if it is possible to index documents based on fields that are not part of meta data and how can the same be shown as part of facet fields.

storing key value pair in multivalued field solr4.0

i am using solr4.0. I want to store key value pairs of attributes in mutlivalued field.
Example: I have some documents (Products) which have attributes as one field and i indexed
attributes as separate documents to power auto suggest . now in some auto suggest i have to show facet count of products also . For this i am using solr joins 4.0 and faceting on attributes. here i want to get the name and id of attributes. how i can achieve this?
The Query is looks like below
localhost:8980/solr/searchapp/select?q=%7B!join+from=attr_id+to=prod_attr_id%7Dterms:red&wt=json&indent=true&facet.field=prod_attr_id&facet=true&rows=1000&fl=product_name,product_id

Solr return file name

I have indexed a couple of documents using solr, now when I perform a search using the admin interface, it returns search results in the XML format.
I am trying to figure out how can I associate a document that I have indexed example: test.pdf with the results that I receive and then serve that document to my user ?
Will solr return to me a unique ID of the document that I index, so that after indexing a document I can store the document along with that UID in my database somewhere and then when the user performs a search solr return the unique ID's of documents that match the search criteria and then I serve them from the database
You will need to add the filename as a stored field. Look at your schema.xml and make sure you declare a field of type string and set the stored attribute to true. By setting stored=true you will ensure that Solr can return the field back in results.
See this page for more information: http://wiki.apache.org/solr/SchemaXml

Resources