O C LC O n lin e C o m p u te r Lib rary C e n te r                  SRU and Lucene                                   Ralp...
SRU Overview  A Simple Web Service  – Supports REST-ful and SOAP requests  – Responses are always XML records  Supports Se...
SRU Features  Explain Records  CQL Query Grammar  Persistent Result Sets  XML Database Records Returned  Index Browses  St...
Explain Records  serverInfo  databaseInfo  metaInfo  indexInfo  schemaInfo  configInfo
serverInfo  Generated Automatically   – host   – port   – database
databaseInfo  From SRWDatabase.props   – databaseInfo.title   – databaseInfo.description   – databaseInfo.contact  Provide...
metaInfo  From SRWDatabase.props  – metaInfo.dateModified  – metaInfo.aggregatedFrom  – metaInfo.dateAggregated
indexInfo  Generated Automatically   – “local” index set and Lucene index names  From SRWDatabase.props   – qualifier.<ind...
schemaInfo  Generated Automatically  – LuceneDocument  From SRWDatabase.props  –   xmlSchemas=<list of name>  –   <schemaN...
schemaInfo Example xmlSchemas=LuceneDocument, DC LuceneDocument.identifier=info:srw/schema/1/L   uceneDocument LuceneDocum...
schemaInfo Example (cont.) DC.identifier=info:srw/schema/1/dc-v1.1 DC.location=http://www.loc.gov/zing/srw  /dc-schema.xsd...
configInfo  Generated Automatically   – maximumRecords (20)   – numberOfRecords (10)   – resultSetTTL (300)  From SRWDatab...
CQL Query Grammar  Builtin: BasicLuceneQueryTranslator  CqlQueryTranslator  – Query makeQuery(CQLNode cn);  – Term getTerm...
Persistent Result Sets   Builtin: LuceneQueryResult
XML Database Records  Builtin: BasicLuceneRecordResolver  RecordResolver  – Void init(Properties props);  – Record resolve...
Index Browses  Builtin:  SRWLuceneDatabase.getTerms()
Stylesheets  From SRWDatabase.props   – explainStyleSheet=     /SRW/explainResponse.xsl   – scanStyleSheet=/SRW/scanRespon...
Making the Magic Happen  Drop the SRWLucene.war into your  <tomcat>/webapps directory  Restart Tomcat  Edit  <tomcat>/weba...
Sample SRWServer.props db.LuceneDemoDB.class=   ORG.oclc.os.SRW.Lucene.SRWLuceneDa   tabase db.LuceneDemoDB.home=   f:/luc...
Sample SRWDatabase.props databaseInfo.title=Lucene Demo Database databaseInfo.description=An index of the source code for ...
Resources  http://www.oclc.org/research/software/srw  http://  staff.oclc.org/~levan/SRWLuceneSource.jar  http://staff.ocl...
Upcoming SlideShare
Loading in …5
×

Sru& and lucene

544 views
497 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
544
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Sru& and lucene

  1. 1. O C LC O n lin e C o m p u te r Lib rary C e n te r SRU and Lucene Ralph LeVan Research Scientist levan@oclc.org
  2. 2. 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 A Gateway to Local Databases
  3. 3. SRU Features Explain Records CQL Query Grammar Persistent Result Sets XML Database Records Returned Index Browses Stylesheets
  4. 4. Explain Records serverInfo databaseInfo metaInfo indexInfo schemaInfo configInfo
  5. 5. serverInfo Generated Automatically – host – port – database
  6. 6. databaseInfo From SRWDatabase.props – databaseInfo.title – databaseInfo.description – databaseInfo.contact Provided Automatically – implementation
  7. 7. metaInfo From SRWDatabase.props – metaInfo.dateModified – metaInfo.aggregatedFrom – metaInfo.dateAggregated
  8. 8. indexInfo Generated 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)
  9. 9. schemaInfo Generated Automatically – LuceneDocument From SRWDatabase.props – xmlSchemas=<list of name> – <schemaName>.identifier= – <schemaName>.location= – <schemaName>.namespace= – <schemaName>.title= – [<schemaName>.transformer=] – [<schemaName>.resolver=]
  10. 10. schemaInfo Example xmlSchemas=LuceneDocument, DC LuceneDocument.identifier=info:srw/schema/1/L uceneDocument LuceneDocument.location=http://www.oclc.org/ standards/Lucene/schema/LuceneDocument.x sd LuceneDocument.namespace=http://www.oclc.o rg/LuceneDocument LuceneDocument.title=Lucene Demo Database records in their internal format
  11. 11. 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
  12. 12. configInfo Generated Automatically – maximumRecords (20) – numberOfRecords (10) – resultSetTTL (300) From SRWDatabase.props – configInfo.maximumRecords – configInfo.numberOfRecords – configInfo.resultSetTTL
  13. 13. CQL Query Grammar Builtin: BasicLuceneQueryTranslator CqlQueryTranslator – Query makeQuery(CQLNode cn); – Term getTerm(); From SRWDatabase.props – SRWLuceneDatabase. CqlToLuceneQueryTranslator= <ClassName>
  14. 14. Persistent Result Sets Builtin: LuceneQueryResult
  15. 15. XML Database Records Builtin: BasicLuceneRecordResolver RecordResolver – Void init(Properties props); – Record resolve(Document doc, String IdFieldName, ExtraDataType extraDataType) From SRWDatabase.props – <schemaName>.resolver=<ClassName> – SRWLuceneDatabase.idFieldName= <FieldName>
  16. 16. Index Browses Builtin: SRWLuceneDatabase.getTerms()
  17. 17. Stylesheets From SRWDatabase.props – explainStyleSheet= /SRW/explainResponse.xsl – scanStyleSheet=/SRW/scanResponse.xsl – searchStyleSheet= /SRW/searchRetrieveResponse.xsl
  18. 18. Making 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
  19. 19. Sample SRWServer.props db.LuceneDemoDB.class= ORG.oclc.os.SRW.Lucene.SRWLuceneDa tabase db.LuceneDemoDB.home= f:/lucene-2.0.0 db.LuceneDemoDB.configuration= SRWDatabase.props
  20. 20. Sample SRWDatabase.props databaseInfo.title=Lucene Demo Database databaseInfo.description=An index of the source code for Lucene databaseInfo.contact=Ralph LeVan (levan@oclc.org) qualifier.cql.serverChoice=contents explainStyleSheet=/SRWLucene/explainResponse.xsl scanStyleSheet=/SRWLucene/scanResponse.xsl searchStyleSheet= /SRWLucene/searchRetrieveResponse.xsl
  21. 21. Resources http://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%2 http://staff.oclc.org/~levan/SRU%20and%20Lucene http://alcme.oclc.org/srw/SRUServerTester.html

×