Apache Solr & schema.xml - apache

I have just began with Apache Solr 4.1 yesterday and though I have managed to get our MySQL data imported successfully in Solr, I am unable to view any data using queries. I suspect the problem is in schema.xml changes (data-config.xml is correct). Here are my questions -
Do I need to add all DB fields in the schema.xml? My table has 275+
fields, and configuring all of them would be a task. I am hoping
there is a way to auto-configure these fields.
Is there a way to use separate schema.xml for my requirement? Where
and how do I configure this? I don't want to modify the example-DIH's
sample schema.xml
Any pointers here would be highly appreciated! I have already gone through this document -
http://wiki.apache.org/solr/DataImportHandler
and I have also read few question posted here, but couldn't find answer to my queries.

1) All the fields that you are mentioning in data-config.xml as field column must add them to schema.xml. No auto-configure is available.
2) No we cannot use separate schema.xml.
Could you please show some of your indexed field that you have mentioned in schema.xml

Related

What is the significance of data-config.xml file in Solr?

and when shall I use it? How is it configured can anyone please tell me in detail?
The data-config.xml file is an example configuration file for how to use the DataImportHandler in Solr. It's one way of getting data into Solr, allowing one of the servers to connect through JDBC (or through a few other plugins) to a database server or a set of files and import them into Solr.
DIH has a few issues (for example the non-distributed way it works), so it's usually suggested to write the indexing code yourself (and POST it to Solr from a suitable client, such as SolrJ, Solarium, SolrClient, MySolr, etc.)
It has been mentioned that the DIH functionality really should be moved into a separate application, but that hasn't happened yet as far as I know.

Creating dynamic facets using apache solr

I'm new to apache solr.
I have uploaded a few log files using solr-cell and I want to create facets based on the content which is there in the log file.
For example: inside my log file I have a record for transaction, I would like to create transactionid as my facet and clicking it should result in a search in the uploaded log files and give me results according to that particular id.
Note: I need to facet field according to the content which is in the log.
As long as the field is indexed, you can facet on it. So, you can use either schemaless configuration or use dynamicField definitions to match and automatically create fields for your log records.
Go through Solr examples first, there should be enough information there.
(updated based on the comments)
If the text needs to be pre-processed and split, there are two basic avenues:
Using DataImportHandler (DIH), probably with LineEntityProcessor and RegexTransformer to split the field into multiple fields
Using UpdateRequestProcessor chains (in solrconfig.xml) and probably clone the field multiple times and then use RegexReplaceProcessorFactory to extract relevant parts. That's even uglier than DIH though as there is no easy way to split one field into many.
Still, specifically for logs, it is better to use something like Logstash with Solr output plugin.
+1 to Alex's answer.
Another alternative is to write a custom update processor where you figure out what field you want to facet on and explicitly add that field to your document.
This makes sense only if you know what kind of fields to expect, based on some pattern. If that is not the case, then using dynamic fields or a schemaless config is your best bet.

Can not find schema.xml file for solrcloud

I want to change schema.xml file, but i can not find it. How to change schema.xml file?
link image : https://drive.google.com/file/d/0BxOsysEbbmMOQ0hoV19KaVo0SUU/view?usp=sharing
As per the image, you are working with the SolrCloud example Collection gettingstarted.
In SolrCloud schema.xml file is maintained by ZooKeeper and so when you change the schema, you will have to upload to ZooKeeper to make it effective.
Please describe in detail what you are looking for?
Note: I still don't have the privilege of comments, or else this should be in comments.

Orchard - Search & Indexing issue

I have a project completed with Orchard CMS. The all functionalities are implemented through modules. Search module was also working till a few days ago, but suddenly it is stopped to working, "without any reason".
The issue is that I can not rebuild/update indexes. When I run indexing, it will only index default list of fields (id, title, body, format, type, author, created, published, modified, culture) but my custom fields are not indexed.
I tried everything but without any success. I tried:
- Deleting Indexing/Search folder with all files
- Reinstalling Search/Indexing/Lucene modules
- Rebuilding and rebuilding indexes....
- Clearing solution and rebuilding...
I didn't extend any of Orchard modules, they are the same as when I downloaded them.
Any advice on this one...?
P.S. Yes, I already checked custom fields thats need to be indexed. :)
Thanks,
If you think the index is corrupted, delete App_data\Sites\Default\Search.settings.xml and App_data\Sites\Default\Indexes, then restart the app pool. You should then be able to rebuild the index.
Apparently you already did this, but for others who may not have, you also need to check the fields you want indexed under Settings/Search. This will include the fields in search.
But for the fields to be included in search, they need to be indexed first. For this, you need to go to Content/Content Types and edit the content type the fields are on. Check "index this content type for search". Also deploy the settings for each field you want indexed, and check "include in the index".
You'll need to run the "Recipe" to create the "Search" index.
It appears that Search + Lucene + Indexing works with Text Fields but not Numeric Fields.
When the search feature is enabled, the Settings screen in the dashboard displays the fields that will be queried from the index (listed on the Search screen).
enter image description here

Lucene and Solr

I am creating the Index using Lucene.
But using the SolrSearch engine to search.
My problem is
while I index I add each filed in my
code using the code
doc.add(fieldname, val, tokenized)
**But my code does not see the schema file
Even copy fields I need to add manually**
Now I want to use the autosuggest feature of Solr
I do not know how to enable this feature while creating the Index
But when I use the simplePostTool to post the data through Solr all is fine.
I cannot do that because I have to
get some text from different urls.
So can someone please advise me how
can I achieve this? A sample code
will be very helpful. In any case If
I can have some code that can see
the schema file and use the
fieldTypes it would be great.
Thanks everyone.
--pramila
See EmbeddedSolrServer at:
http://wiki.apache.org/solr/Solrj
It's a pure Java API to Solr, which will allow you to index your documents using the schema.xml you have defined.