• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
rosewiper / kopost_solr star
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB
  • Files
  • Commit
  • Branches
kopost_solrexamplefilesconfupdate-script.js
Download as .zip file
File name
Commit message
Commit date
bin
첫번째 커밋
06-16
contrib
첫번째 커밋
06-16
dist
첫번째 커밋
06-16
docs
첫번째 커밋
06-16
example
첫번째 커밋
06-16
lib
첫번째 커밋
06-16
licenses
첫번째 커밋
06-16
server
첫번째 커밋
06-16
.project
첫번째 커밋
06-16
CHANGES.txt
첫번째 커밋
06-16
LICENSE.txt
첫번째 커밋
06-16
LUCENE_CHANGES.txt
첫번째 커밋
06-16
NOTICE.txt
첫번째 커밋
06-16
README.txt
첫번째 커밋
06-16
solr_실행 명령어.txt
첫번째 커밋
06-16
File name
Commit message
Commit date
example-DIH
첫번째 커밋
06-16
exampledocs
첫번째 커밋
06-16
files
첫번째 커밋
06-16
films
첫번째 커밋
06-16
resources
첫번째 커밋
06-16
techproducts
첫번째 커밋
06-16
README.txt
첫번째 커밋
06-16
File name
Commit message
Commit date
browse-resources/velocity
첫번째 커밋
06-16
conf
첫번째 커밋
06-16
README.txt
첫번째 커밋
06-16
File name
Commit message
Commit date
lang
첫번째 커밋
06-16
velocity
첫번째 커밋
06-16
currency.xml
첫번째 커밋
06-16
elevate.xml
첫번째 커밋
06-16
email_url_types.txt
첫번째 커밋
06-16
managed-schema
첫번째 커밋
06-16
params.json
첫번째 커밋
06-16
protwords.txt
첫번째 커밋
06-16
solrconfig.xml
첫번째 커밋
06-16
stopwords.txt
첫번째 커밋
06-16
synonyms.txt
첫번째 커밋
06-16
update-script.js
첫번째 커밋
06-16
rosewiper 06-16 9dd39d2 첫번째 커밋 UNIX
Raw Open in browser Change history
function get_class(name) { var clazz; try { // Java8 Nashorn clazz = eval("Java.type(name).class"); } catch(e) { // Java7 Rhino clazz = eval("Packages."+name); } return clazz; } function processAdd(cmd) { doc = cmd.solrDoc; // org.apache.solr.common.SolrInputDocument var id = doc.getFieldValue("id"); logger.info("update-script#processAdd: id=" + id); // The idea here is to use the file's content_type value to // simplify into user-friendly values, such that types of, say, image/jpeg and image/tiff // are in an "Images" facet var ct = doc.getFieldValue("content_type"); if (ct) { // strip off semicolon onward var semicolon_index = ct.indexOf(';'); if (semicolon_index != -1) { ct = ct.substring(0,semicolon_index); } // and split type/subtype var ct_type = ct.substring(0,ct.indexOf('/')); var ct_subtype = ct.substring(ct.indexOf('/')+1); var doc_type; switch(true) { case /^application\/rtf/.test(ct) || /wordprocessing/.test(ct): doc_type = "doc"; break; case /html/.test(ct): doc_type = "html"; break; case /^image\/.*/.test(ct): doc_type = "image"; break; case /presentation|powerpoint/.test(ct): doc_type = "presentation"; break; case /spreadsheet|excel/.test(ct): doc_type = "spreadsheet"; break; case /^application\/pdf/.test(ct): doc_type = "pdf"; break; case /^text\/plain/.test(ct): doc_type = "text" break; default: break; } // TODO: error handling needed? What if there is no slash? if(doc_type) { doc.setField("doc_type", doc_type); } doc.setField("content_type_type_s", ct_type); doc.setField("content_type_subtype_s", ct_subtype); } var analyzer = req.getCore().getLatestSchema() .getFieldTypeByName("text_email_url") .getIndexAnalyzer(); var token_stream = analyzer.tokenStream("content", doc.getFieldValue("content")); var term_att = token_stream.getAttribute(get_class("org.apache.lucene.analysis.tokenattributes.CharTermAttribute")); var type_att = token_stream.getAttribute(get_class("org.apache.lucene.analysis.tokenattributes.TypeAttribute")); token_stream.reset(); while (token_stream.incrementToken()) { doc.addField(type_att.type().replaceAll(/\<|\>/g,"").toLowerCase()+"_ss", term_att.toString()); } token_stream.end(); token_stream.close(); } function processDelete(cmd) { // no-op } function processMergeIndexes(cmd) { // no-op } function processCommit(cmd) { // no-op } function processRollback(cmd) { // no-op } function finish() { // no-op }

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up