Java Code Examples for org.apache.solr.core.SolrCore#isClosed()
The following examples show how to use
org.apache.solr.core.SolrCore#isClosed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppRAKE.java From jate with GNU Lesser General Public License v3.0 | 5 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, 0); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); FrequencyTermBasedFBMaster fwbb = new FrequencyTermBasedFBMaster(searcher, properties, 1); FrequencyTermBased fwb = (FrequencyTermBased) fwbb.build(); TermComponentIndexFBMaster tcib = new TermComponentIndexFBMaster(properties, new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet())); TermComponentIndex termComponentIndex = (TermComponentIndex) tcib.build(); RAKE rake = new RAKE(); rake.registerFeature(FrequencyTermBased.class.getName() + RAKE.SUFFIX_TERM, this.freqFeature); rake.registerFeature(FrequencyTermBased.class.getName() + RAKE.SUFFIX_WORD, fwb); rake.registerFeature(TermComponentIndex.class.getName(), termComponentIndex); List<String> candidates = new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = rake.execute(candidates); terms = cutoff(terms); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // log.error(e.toString()); // } // } }
Example 2
Source File: AppTTF.java From jate with GNU Lesser General Public License v3.0 | 5 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, 0); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); Algorithm ttf = new TTF(); ttf.registerFeature(FrequencyTermBased.class.getName(), this.freqFeature); List<String> candidates = new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = ttf.execute(candidates); terms = cutoff(terms); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // log.error(e.toString()); // } // } }
Example 3
Source File: AppTFIDF.java From jate with GNU Lesser General Public License v3.0 | 5 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, 0); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); Algorithm tfidf = new TFIDF(); tfidf.registerFeature(FrequencyTermBased.class.getName(), this.freqFeature); List<String> candidates = new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = tfidf.execute(candidates); terms = cutoff(terms); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // log.error(e.toString()); // } // } }
Example 4
Source File: AppATTF.java From jate with GNU Lesser General Public License v3.0 | 5 votes |
/** * ranking and filtering * * @param core solr core * @param properties jate properties file * @return List<JATETerm> a list of JATETerm * @throws JATEException */ public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, FrequencyTermBasedFBMaster.FEATURE_TYPE_TERM); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); Algorithm attf = new ATTF(); attf.registerFeature(FrequencyTermBased.class.getName(), freqFeature); List<String> candidates = new ArrayList<>(freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = attf.execute(candidates); terms = cutoff(terms); LOG.info("Complete ATTF term extraction."); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // LOG.error(e.toString()); // } // } }
Example 5
Source File: AppRIDF.java From jate with GNU Lesser General Public License v3.0 | 5 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, 0); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); RIDF attf = new RIDF(); attf.registerFeature(FrequencyTermBased.class.getName(), this.freqFeature); List<String> candidates = new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = attf.execute(candidates); terms = cutoff(terms); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // log.error(e.toString()); // } // } }
Example 6
Source File: AppWeirdness.java From jate with GNU Lesser General Public License v3.0 | 5 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, 0); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); FrequencyTermBasedFBMaster fwbb = new FrequencyTermBasedFBMaster(searcher, properties, 1); FrequencyTermBased fwb = (FrequencyTermBased) fwbb.build(); TTFReferenceFeatureFileBuilder ftrb = new TTFReferenceFeatureFileBuilder(this.referenceFrequencyFilePath); FrequencyTermBased frb = ftrb.build(); Weirdness weirdness = new Weirdness(); weirdness.registerFeature(FrequencyTermBased.class.getName() + Weirdness.SUFFIX_WORD, fwb); weirdness.registerFeature(FrequencyTermBased.class.getName() + Weirdness.SUFFIX_REF, frb); List<String> candidates = new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = weirdness.execute(candidates); terms = cutoff(terms); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // log.error(e.toString()); // } // } }
Example 7
Source File: AppCValue.java From jate with GNU Lesser General Public License v3.0 | 4 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, 0); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); Set<String> uniqueCandidateTerms = freqFeature.getMapTerm2TTF().keySet(); TermComponentIndexFBMaster termCompIndexFeatureBuilder = new TermComponentIndexFBMaster(properties, new ArrayList<>(uniqueCandidateTerms)); TermComponentIndex termComponentIndexFeature = (TermComponentIndex) termCompIndexFeatureBuilder.build(); ContainmentFBMaster cb = new ContainmentFBMaster(searcher, properties, termComponentIndexFeature, uniqueCandidateTerms); Containment cf = (Containment) cb.build(); CValue cvalue = new CValue(); cvalue.registerFeature(FrequencyTermBased.class.getName(), this.freqFeature); cvalue.registerFeature(Containment.class.getName(), cf); List<String> candidates = new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = cvalue.execute(candidates); terms = cutoff(terms); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); LOG.info("Complete CValue term extraction."); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // LOG.error(e.toString()); // } // } }
Example 8
Source File: AppGlossEx.java From jate with GNU Lesser General Public License v3.0 | 4 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, 0); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); FrequencyTermBasedFBMaster fwbb = new FrequencyTermBasedFBMaster(searcher, properties, 1); FrequencyTermBased fwb = (FrequencyTermBased) fwbb.build(); TTFReferenceFeatureFileBuilder ftrb = new TTFReferenceFeatureFileBuilder(this.referenceFrequencyFilePath); FrequencyTermBased frb = ftrb.build(); GlossEx glossex = new GlossEx(); glossex.registerFeature(FrequencyTermBased.class.getName(), this.freqFeature); glossex.registerFeature(FrequencyTermBased.class.getName() + GlossEx.SUFFIX_WORD, fwb); glossex.registerFeature(FrequencyTermBased.class.getName() + GlossEx.SUFFIX_REF, frb); List<String> candidates = new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = glossex.execute(candidates); terms = cutoff(terms); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); log.info("complete GlossEx term extraction."); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // e.printStackTrace(); // log.error("Failed to close current SolrIndexSearcher!" + e.getCause().toString()); // } // } }
Example 9
Source File: AppTermEx.java From jate with GNU Lesser General Public License v3.0 | 4 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { this.freqFeatureBuilder = new FrequencyTermBasedFBMaster(searcher, properties, 0); this.freqFeature = (FrequencyTermBased) freqFeatureBuilder.build(); FrequencyTermBasedFBMaster fwbb = new FrequencyTermBasedFBMaster(searcher, properties, 1); FrequencyTermBased fwb = (FrequencyTermBased) fwbb.build(); TTFReferenceFeatureFileBuilder ftrb = new TTFReferenceFeatureFileBuilder(this.referenceFrequencyFilePath); FrequencyTermBased frb = ftrb.build(); FrequencyCtxDocBasedFBMaster fdbb = new FrequencyCtxDocBasedFBMaster(searcher, properties, 0); FrequencyCtxBased fdb = (FrequencyCtxBased) fdbb.build(); TermEx termex = new TermEx(); termex.registerFeature(FrequencyTermBased.class.getName(), this.freqFeature); termex.registerFeature(FrequencyTermBased.class.getName() + TermEx.SUFFIX_WORD, fwb); // you can register multiple reference feature, as long as the key // has prefix = FrequencyTermBased.class.getName()+TermEx.SUFFIX_REF termex.registerFeature(FrequencyTermBased.class.getName() + TermEx.SUFFIX_REF, frb); termex.registerFeature(FrequencyCtxBased.class.getName() + TermEx.SUFFIX_DOC, fdb); List<String> candidates = new ArrayList<>(this.freqFeature.getMapTerm2TTF().keySet()); filterByTTF(candidates); List<JATETerm> terms = termex.execute(candidates); terms = cutoff(terms); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // log.error(e.toString()); // } // } }
Example 10
Source File: AppChiSquare.java From jate with GNU Lesser General Public License v3.0 | 4 votes |
public List<JATETerm> extract(SolrCore core, JATEProperties properties) throws JATEException { log.info("extract terms from core ... "); if (core.isClosed()) { core.open(); } SolrIndexSearcher searcher = core.getSearcher().get(); // try { FrequencyTermBasedFBMaster ftbb = new FrequencyTermBasedFBMaster(searcher, properties, 0); FrequencyTermBased ft = (FrequencyTermBased) ftbb.build(); //sentence is a context FrequencyCtxSentenceBasedFBMaster fcsbb = new FrequencyCtxSentenceBasedFBMaster(searcher, properties, 0); FrequencyCtxBased fcs = (FrequencyCtxBased) fcsbb.build(); FrequencyCtxBased ref_fcs = (FrequencyCtxBased) (new FrequencyCtxBasedCopier(searcher, properties, fcs, ft, frequentTermFT).build()); //window is a context /*FrequencyCtxWindowBasedFBMaster fcsbb = new FrequencyCtxWindowBasedFBMaster(searcher, properties, null, 5, 0); FrequencyCtxBased fcsb = (FrequencyCtxBased) fcsbb.build(); FrequencyCtxBased ref_fcsb = (FrequencyCtxBased) (new FrequencyCtxWindowBasedFBMaster(searcher, properties, fcsb.getMapCtx2TTF().keySet(), 5, 0).build());*/ CooccurrenceFBMaster cob = new CooccurrenceFBMaster(searcher, properties, ft, this.prefilterMinTTF, fcs, ref_fcs, this.prefilterMinTCF); Cooccurrence co = (Cooccurrence) cob.build(); //feature expected probability for frequent terms ChiSquareFrequentTermsFBMaster cf = new ChiSquareFrequentTermsFBMaster( ref_fcs.getMapCtx2TTF(), ref_fcs.getTerm2Ctx(), ft.getCorpusTotal(), properties); ChiSquareFrequentTerms cff = (ChiSquareFrequentTerms) cf.build(); ChiSquare chi = new ChiSquare(); chi.registerFeature(FrequencyCtxBased.class.getName() + ChiSquare.SUFFIX_TERM, fcs); chi.registerFeature(Cooccurrence.class.getName(), co); chi.registerFeature(ChiSquareFrequentTerms.class.getName(), cff); log.info("start to run chisquare ..."); List<JATETerm> terms = chi.execute(co.getTerms()); log.info("complete chisquare statistics for all terms."); log.info("post-filtering terms ..."); terms = cutoff(terms); log.info("complete postfiltering of terms."); addAdditionalTermInfo(terms, searcher, properties.getSolrFieldNameJATENGramInfo(), properties.getSolrFieldNameID()); return terms; // } finally { // try { // searcher.close(); // } catch (IOException e) { // log.error(e.toString()); // } // } }