Full Text Indexing: Difference between revisions

From GO Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(18 intermediate revisions by one other user not shown)
Line 1: Line 1:
=DEPRECATED=
Please see [[GOlr]] instead.
=Overview=
=Overview=


This document looks at the reasons for using FTI, as well as some of
This document looks at the reasons for using FTI, as well as some of
the software choices that have been made.
the high-level software choices that have been made.


To see the current status, please try [[Full Text Indexing Progress]].
To see the current status, please try [[Full Text Indexing Progress]].


=Rational=


=Rational=
* Existing database text searches on GO are slow and plagued by false positives and false negatives.
=Platforms=
 
== Purpose ==
 
Existing database text searches on GO are slow and plagued by false
positives and false negatives. There are many cross-cutting areas
where fast ontology or annotation searching and/or autocomplete would
be beneficial.


== Groups ==
* Make previously impossible services possible. Things like autocomplete and certain types of search were not practical in our infrastructure (e.g. gene products annotated to multiple terms).


* [[Ontology Development]] - for ontology searches
* Make user interfaces as fast and responsive as possible.
* [[:Category:AmiGO_Hub]] - for gene searches


== Deliverables ==
* Remove needless work and save resources for cases where a relational database makes sense.


=== Evaluation of Solr ===
==Other Uses==


We compared Solr vs direct Lucene connectivity.
Given an in-memory ontology to work with, a cleverly designed schema
could cover a lot of cases where SQL is currently used, but at
potential much higher speed. See [[Full Text Indexing Progress]].


A Solr-based system could also be used in a more general information
caching sense; for example, it may have uses in page display and quick
retrieval of commonly requested data.


* Perl/CLucene lags far behind the official Lucene API and we cannot get the functionality we require. For example, anecdotally, people have gotten better search results using Solr over the old system.
=Evaluation of Solr=
* Solr has a RESTful API and is language neutral for web consumers.
* Solr is fast (see source for some documentation)
Doing a little light benchmarking, Solr by itself seems to run somewhere
between 2 and 10 times as fast as my perl FCGI script over the C++
Lucene bindings, and seemed to hold even under very heavy load. Putting
behind an Apache http proxy seems to more or less double the time, but
makes some issues easier to deal with.
* Solr indexes quickly.


Given this information, and our experiments with other systems (see
Given the below information, the fact that Lucene has dominated the
FTI landscape, and our experiments with other systems (see
[[Full Text Indexing Progress]]), we are moving ahead with a
[[Full Text Indexing Progress]]), we are moving ahead with a
Solr-based solution.
Solr-based solution.


=== Install Solr on Labs ===
==Useful API==


We have an installation on labs at
Perl/CLucene (the system our previous attempt was based on) lags far
behind the official Lucene API and we cannot get the functionality we
require. For example, solutions to the leading '*' problem and support
for DisMax did not appear in the CLucene bindings.


* http://accordion.lbl.gov:8080/solr
Solr also provides different facets to the same underlying data,
giving the ability to have an API specialized for different things
(e.g. search, spellcheck, autocomplete).


Update from 2010-08-06
==Platform Agnosticism==
<pre>
As a note for interested parties, I've got a test installation of Solr
for GO up on accordion (http://accordion.lbl.gov:8080/solr, but not
terribly useful unless you're sending it the right commands). I probably
won't play with it for a while, at least until this release of AmiGO is
out and I try and switch the search backend over for 1.9, but I wanted
to get down what I've seen so far.


Since Solr can connect directly to a mysql database, it is much quicker
While Lucene is written in Java, Solr has a native RESTful API which
than my hand-rolled method--under a minute for terms and under twenty
makes it language neutral for web consumers. There was some potential
minutes for a combined term/gp index. It also allows for just updating
for the old CLucene library to be platform agnostic, but with age
new data as well as having full access while all of these things are
issues (see above) and poor support, these did not pan out.
happening. This would make it much more reasonable to try some of the
more complicated document schemas that we've talked about.


The general search results are better now that we have direct control
==Fast Search==
over the boosting of different fields. There also seems to be
improvements in the text analyzers that come with it. The next version
of Solr should have the term completion we want built in, but right now,
with a little munging on the client, we can get better results than what
we are getting out of the current setup. There is also the option to dig
into the Java code and get exactly what we want, but that would take a
bit more effort (maybe later on).


</pre>
Doing some simple benchmarking, Solr by itself seems to run somewhere
between 2 and 10 times as fast the fastest iteration of the old
system, and seemed to hold even under very heavy load. Putting it
behind an Apache http proxy seems to more or less double the time, but
makes some issues (security, load balancing) easier to deal with.


=== GO Solr Indexing Engine ===
Also see go-dev source for some documentation.


Current implementation uses solr xml to query GO database to build indexes. This approach is quite brittle.
==Fast Indexing==


In future we may do this via a java parser of GAFs + OBO Files
Since Solr can connect directly to a relational database, it is much
quicker to update and less error-prone than previous hand-rolled
methods. In the last check, it took under a minute for a terms index
and under twenty minutes for a combined term/gp index. Solr also
allows for just updating new data as well as having full access while
all of these things are happening.


=== Solr Indexing Engine Optimizations ===
==Better Results==


=== Integrate ===
The general search results are better now that we have direct control
 
over the boosting of different fields. There also seems to be
==== Queries ====
improvements in the text analyzers that come with it. The next version
 
of Solr should have the term completion we want built in, but right
==== Autocomplete ====
now, with a little munging on the client, we can get better results
 
than what we are getting out of the current setup. There is also the
==== Advanced ====
option to dig into the Java code and get exactly what we want, but
that would take a bit more effort (maybe later on).


=Caveats=
=Caveats=

Latest revision as of 18:40, 7 April 2014

DEPRECATED

Please see GOlr instead.

Overview

This document looks at the reasons for using FTI, as well as some of the high-level software choices that have been made.

To see the current status, please try Full Text Indexing Progress.

Rational

  • Existing database text searches on GO are slow and plagued by false positives and false negatives.
  • Make previously impossible services possible. Things like autocomplete and certain types of search were not practical in our infrastructure (e.g. gene products annotated to multiple terms).
  • Make user interfaces as fast and responsive as possible.
  • Remove needless work and save resources for cases where a relational database makes sense.

Other Uses

Given an in-memory ontology to work with, a cleverly designed schema could cover a lot of cases where SQL is currently used, but at potential much higher speed. See Full Text Indexing Progress.

A Solr-based system could also be used in a more general information caching sense; for example, it may have uses in page display and quick retrieval of commonly requested data.

Evaluation of Solr

Given the below information, the fact that Lucene has dominated the FTI landscape, and our experiments with other systems (see Full Text Indexing Progress), we are moving ahead with a Solr-based solution.

Useful API

Perl/CLucene (the system our previous attempt was based on) lags far behind the official Lucene API and we cannot get the functionality we require. For example, solutions to the leading '*' problem and support for DisMax did not appear in the CLucene bindings.

Solr also provides different facets to the same underlying data, giving the ability to have an API specialized for different things (e.g. search, spellcheck, autocomplete).

Platform Agnosticism

While Lucene is written in Java, Solr has a native RESTful API which makes it language neutral for web consumers. There was some potential for the old CLucene library to be platform agnostic, but with age issues (see above) and poor support, these did not pan out.

Fast Search

Doing some simple benchmarking, Solr by itself seems to run somewhere between 2 and 10 times as fast the fastest iteration of the old system, and seemed to hold even under very heavy load. Putting it behind an Apache http proxy seems to more or less double the time, but makes some issues (security, load balancing) easier to deal with.

Also see go-dev source for some documentation.

Fast Indexing

Since Solr can connect directly to a relational database, it is much quicker to update and less error-prone than previous hand-rolled methods. In the last check, it took under a minute for a terms index and under twenty minutes for a combined term/gp index. Solr also allows for just updating new data as well as having full access while all of these things are happening.

Better Results

The general search results are better now that we have direct control over the boosting of different fields. There also seems to be improvements in the text analyzers that come with it. The next version of Solr should have the term completion we want built in, but right now, with a little munging on the client, we can get better results than what we are getting out of the current setup. There is also the option to dig into the Java code and get exactly what we want, but that would take a bit more effort (maybe later on).

Caveats

Scaling

While there are impressive speed improvements with FTI, given the uses that we have in mind (e.g. text completion as a ubiquitous public and private service), there is the worry that we could be overwhelmed with requests or that our hardware would be insufficient.

Solr and Lucene should be designed with much heavier tasks in mind on larger datasets. We (currently) believe that there is no problem here, and our benchmarks seem to imply the same thing; but we likely won't know until we really have to deal with it.

The worst case scenario is that we restrict it to internal use and external applications that we've okayed.

Security

Solr doesn't supply it's own security, which has to then be done either through the hosting server (Jetty in this case) or the proxy server (which causes a speed hit) if firewalled. I can't say I'm thrilled with the options, but I got something like I wanted through some rewrite rules on Jetty.