sru and lucene

21
OCLC Online Computer Library Center SRU and Lucene Ralph LeVan Research Scientist [email protected]

Upload: rupert

Post on 31-Jan-2016

51 views

Category:

Documents


0 download

DESCRIPTION

SRU and Lucene. Ralph LeVan Research Scientist [email protected]. SRU Overview. A Simple Web Service Supports REST-ful and SOAP requests Responses are always XML records Supports Search and Retrieve Uses a Standard Query Grammar Supports Self-Configuring Clients - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: SRU and Lucene

OCLC Online Computer Library Center

SRU and LuceneRalph LeVan

Research Scientist

[email protected]

Page 2: SRU and Lucene

SRU OverviewSRU OverviewA Simple Web Service– Supports REST-ful and SOAP requests– Responses are always XML records

Supports Search and Retrieve

Uses a Standard Query Grammar

Supports Self-Configuring Clients

A Gateway to Local Databases

Page 3: SRU and Lucene

SRU FeaturesSRU FeaturesExplain Records

CQL Query Grammar

Persistent Result Sets

XML Database Records Returned

Index Browses

Stylesheets

Page 4: SRU and Lucene

Explain RecordsExplain RecordsserverInfo

databaseInfo

metaInfo

indexInfo

schemaInfo

configInfo

Page 5: SRU and Lucene

serverInfoserverInfoGenerated Automatically– host– port– database

Page 6: SRU and Lucene

databaseInfodatabaseInfoFrom SRWDatabase.props– databaseInfo.title– databaseInfo.description– databaseInfo.contact

Provided Automatically– implementation

Page 7: SRU and Lucene

metaInfometaInfoFrom SRWDatabase.props– metaInfo.dateModified– metaInfo.aggregatedFrom– metaInfo.dateAggregated

Page 8: SRU and Lucene

indexInfoindexInfoGenerated Automatically– “local” index set and Lucene index names

From SRWDatabase.props– qualifier.<indexSet>.<indexName> =

<LuceneIndexName>– Used only if you want to map other index

names to your Lucene indexes (e.g. qualifier.dc.identifier=id)

Page 9: SRU and Lucene

schemaInfoschemaInfoGenerated Automatically– LuceneDocument

From SRWDatabase.props– xmlSchemas=<list of name>– <schemaName>.identifier=– <schemaName>.location=– <schemaName>.namespace=– <schemaName>.title=– [<schemaName>.transformer=]– [<schemaName>.resolver=]

Page 10: SRU and Lucene

schemaInfo ExampleschemaInfo ExamplexmlSchemas=LuceneDocument, DC

LuceneDocument.identifier=info:srw/schema/1/LuceneDocument

LuceneDocument.location=http://www.oclc.org/standards/Lucene/schema/LuceneDocument.xsd

LuceneDocument.namespace=http://www.oclc.org/LuceneDocument

LuceneDocument.title=Lucene Demo Database records in their internal format

Page 11: SRU and Lucene

schemaInfo Example (cont.)schemaInfo Example (cont.)

DC.identifier=info:srw/schema/1/dc-v1.1

DC.location=http://www.loc.gov/zing/srw/dc-schema.xsd

DC.title=DC: Dublin Core Elements

DC.transformer=LuceneToDC.xsl

Page 12: SRU and Lucene

configInfoconfigInfoGenerated Automatically– maximumRecords (20)– numberOfRecords (10)– resultSetTTL (300)

From SRWDatabase.props– configInfo.maximumRecords– configInfo.numberOfRecords– configInfo.resultSetTTL

Page 13: SRU and Lucene

CQL Query GrammarCQL Query GrammarBuiltin: BasicLuceneQueryTranslator

CqlQueryTranslator– Query makeQuery(CQLNode cn);– Term getTerm();

From SRWDatabase.props– SRWLuceneDatabase.

CqlToLuceneQueryTranslator= <ClassName>

Page 14: SRU and Lucene

Persistent Result SetsPersistent Result SetsBuiltin: LuceneQueryResult

Page 15: SRU and Lucene

XML Database RecordsXML Database RecordsBuiltin: BasicLuceneRecordResolver

RecordResolver– Void init(Properties props);– Record resolve(Document doc, String

IdFieldName, ExtraDataType extraDataType)

From SRWDatabase.props– <schemaName>.resolver=<ClassName>– SRWLuceneDatabase.idFieldName=

<FieldName>

Page 16: SRU and Lucene

Index BrowsesIndex BrowsesBuiltin: SRWLuceneDatabase.getTerms()

Page 17: SRU and Lucene

StylesheetsStylesheetsFrom SRWDatabase.props– explainStyleSheet=

/SRW/explainResponse.xsl– scanStyleSheet=/SRW/scanResponse.xsl– searchStyleSheet=

/SRW/searchRetrieveResponse.xsl

Page 18: SRU and Lucene

Making the Magic HappenMaking the Magic Happen

Drop the SRWLucene.war into your <tomcat>/webapps directory

Restart Tomcat

Edit <tomcat>/webapps/SRWLucene/WEB-INF/classes/SRWServer.props

Restart Tomcat

Page 19: SRU and Lucene

Sample SRWServer.propsSample SRWServer.props

db.LuceneDemoDB.class= ORG.oclc.os.SRW.Lucene.SRWLuceneDatabase

db.LuceneDemoDB.home= f:/lucene-2.0.0

db.LuceneDemoDB.configuration= SRWDatabase.props

Page 20: SRU and Lucene

Sample SRWDatabase.propsSample SRWDatabase.propsdatabaseInfo.title=Lucene Demo Database

databaseInfo.description=An index of the source code for Lucene

databaseInfo.contact=Ralph LeVan ([email protected])

qualifier.cql.serverChoice=contents

explainStyleSheet=/SRWLucene/explainResponse.xsl

scanStyleSheet=/SRWLucene/scanResponse.xsl

searchStyleSheet= /SRWLucene/searchRetrieveResponse.xsl

Page 21: SRU and Lucene

ResourcesResourceshttp://www.oclc.org/research/software/srw

http://staff.oclc.org/~levan/SRWLuceneSource.jar

http://staff.oclc.org/~levan/SRWLucene.war

http://staff.oclc.org/~levan/Implementing%20an%20SRWLuceneDatabase.doc

http://staff.oclc.org/~levan/SRU%20and%20Lucene.ppt

http://alcme.oclc.org/srw/SRUServerTester.html