Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex solar在搜索要求模糊和通配符搜索时失败_Regex_Apache_Search_Solr_Autosuggest - Fatal编程技术网

Regex solar在搜索要求模糊和通配符搜索时失败

Regex solar在搜索要求模糊和通配符搜索时失败,regex,apache,search,solr,autosuggest,Regex,Apache,Search,Solr,Autosuggest,我需要什么 我需要建立类似亚马逊和其他电子网站使用暗示搜索搜索搜索 我尝试过使用wilcard搜索,它的工作原理类似于q=string;但当错误的单词显示plnts时,我无法搜索,bcs仅适用于0,1形式 当我使用fuzzysearch q=“string~1”时,当plants->writedplnts时,它会给出结果,但在搜索关键字zer以查找肥料时失败 我使用过Suggester,但它不是fullfling搜索要求链接: 我挣扎了3天才找到解决方案 我在谷歌上找到了twitter使用的链

我需要什么

  • 我需要建立类似亚马逊和其他电子网站使用暗示搜索搜索搜索

  • 我尝试过使用wilcard搜索,它的工作原理类似于q=string;但当错误的单词显示plnts时,我无法搜索,bcs仅适用于0,1形式

  • 当我使用fuzzysearch q=“string~1”时,当plants->writedplnts时,它会给出结果,但在搜索关键字zer以查找肥料时失败

  • 我使用过Suggester,但它不是fullfling搜索要求链接:

  • 我挣扎了3天才找到解决方案

  • 我在谷歌上找到了twitter使用的链接:typehaed js

  • 我用过的代码

        function startSolrSearch ()
        {
        var srchval = $("#productSearch").val().trim();
        if (srchval.length >= 1){
        srchval = srchval.replace(/'|"/g,"").replace(/ /g,"*+*");
    
        srchval = srchval.replace(/ /g,"+AND+");
            console.log(srchval);
        srchval = "*"+srchval+"*";
    
    
        for(var i = 0; i < solrPendingRequests.length; i++){
        solrPendingRequests[i].abort();
        }
        console.log(srchval);
        solrPendingRequests.push($.ajax({
        type : "GET",
        url : solrbasepath + "solr/afeef/select?q="+srchval+'~'+1+"&facet=true&facet.field=title&facet.field=keywords&facet.field=category&indent=on&qt=spellchecker&wt=json&hl=true&hl.fl=title+keywords+model_name&hl.simple.pre=<b>&hl.simple.post=<%2Fb>&hl.usePhraseHighlighter=true&hl.highlightMultiTerm=true&hl.snippets=1&start=0&rows=100",
        dataType : 'JSONP',
        cache : false,
        jsonp: 'json.wrf',
        success : function(html) {
    
        getSearchData (html);
    
        }
        }));
        } 
        else {
    
    
        $('#searchsuggestion .linkresults').html('');
        $('#searchsuggestion').hide();
        $('.close_search').hide();
        }
    
  • 我需要的建议,我如何可以使用类似亚马逊在那里的电子商务网站使用的提示性搜索


    • 更好的是,您应该使用solr拼写检查组件来更好地控制它。拼写检查提供了一系列设置,您可以通过这些设置根据您的用例对其进行配置

      以及为什么在搜索关键字zer查找肥料时模糊查询不起作用?有关模糊搜索,请参阅本文档

      Lucene支持基于Levenshtein距离或编辑距离算法的模糊搜索。要进行模糊搜索,请在单个单词词尾使用波浪号“~”符号。例如,要搜索拼写与“roam”相似的术语,请使用模糊搜索: 漫游~ 此搜索将查找泡沫和漫游等术语。 从Lucene 1.9开始,额外的(可选)参数可以指定所需的相似性。该值介于0和1之间,如果值接近1,则仅匹配相似度较高的术语。例如: 漫游~0.8 如果未给出参数,则使用的默认值为0.5


      您提到了匹配的相似度值=1,因此它不会返回结果。我认为在相似度参数中使用较小的值可以解决您的问题(尝试0到1之间的值,看看它是如何工作的)。

      感谢mirad的回答,但根据url:{!q.op=和%20df=title}zer~1&indent=on&q.op=AND&facet=true&facet.field=title&facet.field=keywords&debugQuery=on&qt=spellchecker&wt=json&hl=true&hl.fl=title+keywords+model&u-name&hl.simple.pre=%3Cb%3E&hl.simple.post=%3C%2bb%3E&hl.usePhraseHighlighter=true&hl.highlightMultiTerm=true&hl.snippets=1&start=0&rows=10&json.wrquery1120581398486838=14570457178913我还使用了拼写检查器,尽管它不工作。嘿,如果您使用了zer~1,请尝试在查询中使用zer~0.5或zer~0.4。即使您使用拼写检查组件或编写自己的自定义拼写检查算法,您也必须确定“zer~k”中的k值,保持k值较低,也可能存在错误匹配。
        http://www.supplified.com:8983/solr/vikas/select?q=zer~1 OR q="*zer*" &ind   nt=on&q.op=AND&facet=true&facet.field=title&facet.field=keywords&debugQuery=on&qt=spellchecker&wt=json&hl=true&hl.fl=title+keywords+model_name&hl.simple.pre=%3Cb%3E&hl.simple.post=%3C%2Fb%3E&hl.usePhraseHighlighter=true&hl.highlightMultiTerm=true&hl.snippets=1&start=0&rows=10&json.wrf=jQuery111205813984868582338_1454571708911&_=1454571708913