zoukankan      html  css  js  c++  java
  • Tp中使用Xunsearch

    可以将安装目录下的核心代码拷贝到Vendor中。

    命名为xunsearch。

    然后引入使用。

    vendor('xunsearch.lib.XS');
    $xs = new XS('demo');   // 自动使用 $prefix/sdk/php/app/demo.ini 作项目配置文件
    $docs = $xs->search->search('测试');
    print_r($docs);
    
    Array
    (
        [0] => XSDocument Object
            (
                [_data:XSDocument:private] => Array
                    (
                        [pid] => 2
                        [subject] => 测试第二篇
                        [chrono] => 1314336160
                        [message] => 这里是第二篇文章的内容
                    )
    
                [_terms:XSDocument:private] => 
                [_texts:XSDocument:private] => 
                [_charset:XSDocument:private] => UTF-8
                [_meta:XSDocument:private] => Array
                    (
                        [docid] => 2
                        [rank] => 1
                        [ccount] => 0
                        [percent] => 100
                        [weight] => 0.11754341423512
                    )
    
            )
    
        [1] => XSDocument Object
            (
                [_data:XSDocument:private] => Array
                    (
                        [pid] => 1
                        [subject] => 关于 xunsearch 的 DEMO 项目测试
                        [chrono] => 1314336158
                        [message] => 项目测试是一个很有意思的行为!
                    )
    
                [_terms:XSDocument:private] => 
                [_texts:XSDocument:private] => 
                [_charset:XSDocument:private] => UTF-8
                [_meta:XSDocument:private] => Array
                    (
                        [docid] => 1
                        [rank] => 2
                        [ccount] => 0
                        [percent] => 98
                        [weight] => 0.11563987284899
                    )
    
            )
    
        [2] => XSDocument Object
            (
                [_data:XSDocument:private] => Array
                    (
                        [pid] => 3
                        [subject] => 项目测试第三篇
                        [chrono] => 1314336168
                        [message] => 俗话说,无三不成礼,所以就有了第三篇
                    )
    
                [_terms:XSDocument:private] => 
                [_texts:XSDocument:private] => 
                [_charset:XSDocument:private] => UTF-8
                [_meta:XSDocument:private] => Array
                    (
                        [docid] => 3
                        [rank] => 3
                        [ccount] => 0
                        [percent] => 98
                        [weight] => 0.11554631590843
                    )
    
            )
    
    )
    
  • 相关阅读:
    关于datatable的一些操作以及使用adapter对数据的操作
    P1083 借教室
    P2264 情书
    P1772 [ZJOI2006]物流运输
    P1353 [USACO08JAN]跑步Running
    P2903 [USACO08MAR]麻烦的干草打包机The Loathesome Hay Baler
    P2895 [USACO08FEB]流星雨Meteor Shower
    P2665 [USACO08FEB]连线游戏Game of Lines
    P2896 [USACO08FEB]一起吃饭Eating Together
    P2925 [USACO08DEC]干草出售Hay For Sale
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/12021610.html
Copyright © 2011-2022 走看看