按令牌顺序搜索

时间:2016-02-19 09:02:27

标签: solr

民间,

我们有一个要求,我们想按照令牌的顺序搜索solr中的项目。

e.g。如果q = google facebook

然后它应该为匹配的文档提供关键字" google"第一 然后它应该提供匹配的文件与关键字"脸书"

以下是配置,但它不起作用。

 OWLDataFactory factory = manager.getOWLDataFactory();
            Set<OWLNamedIndividual> found= new HashSet<>(); 
            List<OWLNamedIndividual> list= new ArrayList<>();
            List<OWLNamedIndividual> SeaIcelist= new ArrayList<>();
            PrefixManager pm = new DefaultPrefixManager("http://www.semanticweb.org/SeaIceOntology#");

            OWLNamedIndividual root = factory.getOWLNamedIndividual(":thickness", pm);
            OWLObjectProperty p = factory.getOWLObjectProperty(IRI
                    .create("http://www.semanticweb.org/SeaIceOntology#similarTo")); 
            OWLReasoner r= new StructuralReasonerFactory().createNonBufferingReasoner(loadMODIS);

            found.add(root); 
            list.add(root); 


            while(i < list.size()){ 
                for(Node<OWLNamedIndividual> ind:r.getObjectPropertyValues
                        (list.get(i), (OWLObjectPropertyExpression)p)){ 
                    for(OWLNamedIndividual nind:ind){
                        if(found.add(nind)){
                            list.add(nind);
                            /* select specific individuals to the SeaIcelist */
                            for(OWLClassExpression ex : nind.getTypes(loadMODIS)) {
                                while(ex.asOWLClass().getSuperClasses(loadMODIS).iterator().hasNext()){
                                    for(OWLClassExpression cl:ex.asOWLClass().getSuperClasses(loadMODIS)) {
                                        if (cl.equals(factory.getOWLClass
                                                (IRI.create("http://www.semanticweb.org/SeaIceOntology#EarthScienceProperty"))) ){
                                            SeaIcelist.add(nind);
                                            break;
                                        }
                                    }
                                    ex = ex.asOWLClass().getSuperClasses(loadMODIS).iterator().next();
                                }
                             }
                            /* select specific individuals to the SeaIcelist */
                        }
                    }
                }
                i ++;
            }

            for (int j = 1; j < i; j ++){
                System.out.println("These are all the terms which has similar meanings." + list.get(j).toStringID());
            }

            int size = SeaIcelist.size();
            for (int j = 0; j < size; j ++){
                System.out.println("These are all the standard terms which has similar meanings." + SeaIcelist.get(j).toStringID());
            }

1 个答案:

答案 0 :(得分:0)

每个术语都可以从第一个术语开始,然后在每个下一学期减少delta。例如,它可能类似于&#34; google ^ 0.9 facebook ^ 0.5&#34;这会增加谷歌对Facebook的影响。提升会乘以该条款的正常分数,并会影响其相对于其他条款的重要性。