I have an opensearch description and am supposed to send my queries using that programmatically. Unfortunately, I'm really new to all of this- are there any examples out there using Lucene and Java?
Thanks!
I don't know nothing about OpenSearch but I can give you some hints of Lucene. To make Lucene search you have to first make a Lucene index of your data (text files, xml files, database, etc..).
There are a lot of example how to use Lucene all over the internet. This looks quite good example how to make a Lucene index.
This covers all: indexing, searching and displaying result (It is very simple example). Because your question is not very specific, this is as I can help. If you'll have a specific problem, I would be happy to help.
Related
I am beginner in solr7.5.0 and I don't know each and every modules of it. As I'm building question answer system I want to integrate wordnet so I can get better query responses. I googled it and found some methods and previous question but I'm really confused on how to do in solr version 7.5.0 step by step.
Edit: solr7.5.0 having WordnetSynonymParser class, So if anyone worked on same please guide me how I can use this class or is there another way to do it? and can I use python to do it?
thanks in advance.
This article is very useful for this question, and the integration of wordnet can be done by, there are WordNet prolog file('wn_s.pl') which has synsets, we can convert it to synonyms.txt which can be consumable by Solr. So, to convert wn_s.pl file we can use Syns2Syms.java. It generates Synonyms.txt which we can index to solr.
But WordNet expansion will only yield marginal gains in relevance if it is domain specific search, so simply creating your own synonyms list based on the common tokens in your index will give more relevance.
I am using Lucene 3.6 and i am trying to implement FieldCache. I have seen some posts but did not get any clear idea. Can anyone please suggest me any link where i can find proper example of FieldCache and how to use it while searching.
You dont typically use it directly, it is an internal API used by Lucene.
If you are extending Lucene's search API and need to use it, you will need to provide more details.
I want to implement a search functionality in my web application that I am building using java technology. I would have to search through the database, depending on the user query and will display the results. Which way can I go about doing this(please take note I am using java technology)??.Thanks.
You can use a product like http://lucene.apache.org/core/ or http://lucene.apache.org/solr/ for this instead of writing this on your own.
Lucene is a high-performance search engine for documents.
SOLR is built on top of Lucene and provides additional features (like hit highlighting, faceted search, database integration or rich document (Word, PDF, ..) search)
Lucene will analyze your text data and build up an index. When performing a search you run a lucene query against this index.
Assuming you mean free text searching of the data in the database...
For free text searching Lucene and/or SOLR are very good solutions. These work by creating a separate index of the data in your database. It is up to you to either pull the data from the database and index it using Lucene/SOLR or arrange your code that writes to the database to also update the Lucene/SOLR index. Given what you have said it sounds like this is being retrofitted to an existing database so pulling the data and indexing it may be the best solution. In this case SOLR is probbaly a better fit as it is a packaged solution.
Another option would be Hibernate Search. Again this would be a solution to use if you are starting out. It would be more difficult to add after the fact.
Also bear in mind some databases support free text searching in addition to normal relational queries and could be worth a look. SQL Server certainly has text search capabilities and I would imagine other databases have some sort of support. I am not too sure how you access these but I would expect to be able to do it using SQL via JDBC. It is likely to be database specific though.
If you just mean normal SQL searching then there are a whole load of Java EE technologies, plain JDBC, Spring templates, ORM technologies (JPA, JDO, Hibernate etc). The list goes on and it would be difficult to suggest any particular approach without a lot more info.
I am making an application where I am going to need full text search so I found Compass, but that project is no longer maintained and is replaced by elasticsearch. However I don't understand it. Is it a own server that I need to do requests (get, put) etc against and then parse the JSON response? Are there no annotations like in Compass? I don't understand how this is a replacement and how I use it with Java EE.
Or are there other better projects to use?
Elasticsearch is a great choice nowadays, if you liked Compass you'll love it. Have a look at this answer that the author gave here on which he explains why he went ahead creating elasticsearch after Compass. In fact elasticsearch and Solr make both the use of Lucene pretty easy, adding also some features to it. You basically have a whole search engine server which is able to index your data, which you can then query in order to retrieve the data that you indexed.
Elasticsearch exposes RESTful APIs and it's JSON based, but if you are looking for annotations in the Compass style you can have a look at the Object Search Engine Mapper for ElasticSearch.
I would say give a try on lucene or solr. It creates a DocumentFileSystem for faster indexing
I would recommend either
Elasticsearch, if the system is big and need clustering.
Lucene or Solr, if you want to code at a low level
Hibernate search, if you are using Hibernate as your ORM.
I posted this in the Nabble group also, but figured may get some advice here.
is there a way to get SOLR to search whatever index i tell it to during search time without using multiple cores?
i dont build my indexes with SOLR, i build them with my own java class, but i do use SOLR to search them later. It would be nice to tell Solr during search time which index to access.
I have combined them as well, and this works but there are a few issues in my particular case, that make it easier to solve with sending the index name/path at search.
thanks
I don't really think you can really do what you are looking for here. Part of the simplicity of Solr comes from have the core (and therefore index) in the URL. What you could do is hack how Solr works to add another parameter to the url and then when Solr goes to do a search use that to determine which index it uses. I think you might end up throwing out all the auto warming of caches etc though.
Out of curiosity, why do you NOT want to use multiple cores? Is it that you expect to have thousands and thousands, or that each index is incredibly transient?
Eric
You might want to look into Lucid Works' Enterprise Solr release.
http://www.lucidimagination.com/products/lucidworks-search-platform/enterprise
They implement Collections in a way that is similar to your use case.