sru and lucene

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

Upload: aubrey-prince

Post on 01-Jan-2016

64 views

Category:

Documents


2 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

OCLC Online Computer Library Center

SRU and LuceneRalph LeVan

Research Scientist

[email protected]

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

SRU FeaturesSRU FeaturesExplain Records

CQL Query Grammar

Persistent Result Sets

XML Database Records Returned

Index Browses

Stylesheets

Explain RecordsExplain RecordsserverInfo

databaseInfo

metaInfo

indexInfo

schemaInfo

configInfo

serverInfoserverInfoGenerated Automatically– host– port– database

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

Provided Automatically– implementation

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

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)

schemaInfoschemaInfoGenerated Automatically– LuceneDocument

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

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

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

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

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

CQL Query GrammarCQL Query GrammarBuiltin: BasicLuceneQueryTranslator

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

From SRWDatabase.props– SRWLuceneDatabase.

CqlToLuceneQueryTranslator= <ClassName>

Persistent Result SetsPersistent Result SetsBuiltin: LuceneQueryResult

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>

Index BrowsesIndex BrowsesBuiltin: SRWLuceneDatabase.getTerms()

StylesheetsStylesheetsFrom SRWDatabase.props– explainStyleSheet=

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

/SRW/searchRetrieveResponse.xsl

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

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

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

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