Giter Site home page Giter Site logo

sphinxsearch's People

Contributors

alpha0010 avatar anpez avatar brianmcdo avatar gawdl3y avatar levi730 avatar lighta971 avatar qsun avatar silentred avatar smitp avatar splinter89 avatar tjoelsson avatar tmajne avatar waffle-with-pears avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sphinxsearch's Issues

search result excerpts and modelname

Hi.
I am trying to get search result excerpts working when using a modelname.

my search library function is as follows.

public static function objects($search,$orderBy, $order, $objectType,$deleted){
        if ($search){
            $results = SphinxSearch::search($search,'mainIndex')
                        ->setMatchMode(\Sphinx\SphinxClient::SPH_MATCH_EXTENDED )  
                        ->SetRankingMode(\Sphinx\SphinxClient::SPH_RANK_SPH04)                      
                        ->SetFieldWeights(
                            array(
                                'name'  => 10,
                                'description' => 8
                                )) 
                        ->filter('adjacencyId', array(0,Auth::user()->object_id),false)
                        ->limit(1000);
            Search::order($results,$orderBy,$order);
            if(!isset($deleted)){
                $results->filter('deleted',0);
                }
            if(isset($objectType)){
                $results->filter('object_types_id', $objectType);           
                }
            $result = $results->get(true);
            $excerpt = $results->excerpt(current($result)->content); //<--- errors here
            return $result;
            }
        }

i get the error "Document must be a string"

Is this possible?

Question: User input / escapeString

Quick question: Is it best practice to use SphinxClient::escapeString() when passing user input? If so, I can't find a way to access this without making a - new \Sphinx\SphinxClient.

limits bug

I think this is a bug at least, i have sorting my data by most recent entries (date field). I got it working right, as soon as i put in the ->limit(200) my data is no longer the recent stuff. It loses its sorting. I can provide screenshots of the results if needed.

    $results = SphinxSearch::search("pam_unix", "ninjalogs")
        ->setFieldWeights(array('devicereportedtime' => 10))
        ->limit(200)
        ->setMatchMode(\Sphinx\SphinxClient::SPH_MATCH_ANY)
        ->setSortMode(\Sphinx\SphinxClient::SPH_SORT_ATTR_DESC, 'devicereportedtime')
        ->get(true);

I temporarily added this line to sphinxsearch.php and took out my ->limit(200) and it worked properly.

  $this->_connection->setLimits(0, 200, 200, 0);

I am not sure why its not taking the 200 and using it properly.

Any ideas?

Geo distance search without query

Hi,
I just wanna search based on geo distance from a certain coordinate, but without any query keyword. I've tried using empty string and null but they always match nothing. When I give it some keyword, it works fine.
Can I achieve that with Sphinx? Or any other idea?

Thank you.

string based Filters

Hi.
I am looking at the code and can see that filters only work on numeric values.

i would like to help add support for text. do you recon:

  1. adding a new filterText function in SphinxSearch.php and SphinxClient.php
  2. or the restriction and thus amend the addQuery to pack strings where applicable...

I will play but wanted to know if you had a preferance to code flow etc..

many thanks

calvin streeting

lavarel 5 ?

The author whether to increase support for laravel5 ?

syntax error, unexpected '['

i had to change line 60 to
$val = $values;
form
$val = [(int) $values];

in scalia/sphinxsearch/src/Scalia/SphinxSearch/SphinxSearch.php

not sure if my system (aka missing something silly)

many thanks...

calvin

Two Different Index, Source and searching

Thank you for this great package!

I am developing a wep application that has articles and career ads. I have two search form, 1 for articles and 1 for career ads.

I want to search for careers only, no results from the articles index.

How should I do that in the config?

Are there any examples?

It'd be great if theres an example...

I'm stumped trying to figure out how to use elasticsearch.

No setMatchMode() method

Can you please add the following method to your package? I tried extending it but the $_connection property is "private".

function setMatchMode($mode)
{
$this->_connection->setMatchMode($mode);
return $this;
}

question: how to search through multiple indexes

Hello!

Could you help me please with this issue?

I'v got 2 indexes: offers and products. Below you can look through some of my config: https://gist.github.com/AleksMeshkov/9738763

So how can I perform a search with this 2 indexes simultaneously? How should I setup my sphinx search config? (https://gist.github.com/AleksMeshkov/9738879)

Yep, I saw https://github.com/scalia/sphinxsearch#searching-through-multiple-sphinx-indexes-maindelta But I can't apply that in my case.

Thank's in advance!

Support Eloquents withTrashed

hi..

i altered the get function to work with Eloquents withTrashed option (added as an option to get..)

many thanks

calvin
...

public function get($respect_sort_order = false,$withTrashed = false)
{
$this->_total_count = 0;
$result = $this->_connection->query($this->_search_string, $this->_index_name);

// Process results.
if ($result)
{
  // Get total count of existing results.
  $this->_total_count = (int) $result['total_found'];
  // Get time taken for search.
  $this->_time = $result['time'];

  if($result['total'] && isset($result['matches']))
  {
    // Get results' id's and query the database.
    $matchids = array_keys($result['matches']);
    $idString =  implode(',', $matchids);

    $config = isset($this->_config['mapping']) ? $this->_config['mapping'] : $this->_config[$this->_index_name];
    if ($config)
    {
      if (isset($config['modelname']))
      {
        if ($this->_eager_loads) {
            if ($withTrashed) {
                $result = call_user_func_array($config['modelname'] . "::whereIn", array($config['column'], $matchids))->orderByRaw(\DB::raw("FIELD(id, $idString)"))->withTrashed()->with($this->_eager_loads)->get();
            }
            else {
                $result = call_user_func_array($config['modelname'] . "::whereIn", array($config['column'], $matchids))->orderByRaw(\DB::raw("FIELD(id, $idString)"))->with($this->_eager_loads)->get();
            }
        } else {
            if ($withTrashed) {
                $result = call_user_func_array($config['modelname'] . "::whereIn", array($config['column'], $matchids))->orderByRaw(\DB::raw("FIELD(id, $idString)"))->withTrashed()->get();
            }
            else {
                $result = call_user_func_array($config['modelname'] . "::whereIn", array($config['column'], $matchids))->orderByRaw(\DB::raw("FIELD(id, $idString)"))->get();
            }
        }
      }
      else
      {
        $result = \DB::table($config['table'])->whereIn($config['column'], $matchids)->orderByRaw(\DB::raw("FIELD(id, $idString)"))->get();
      }

    }
  }
  else
  {
    $result = array();
  }
}

....

Remove int casting from filter function in SphinxSearch

Hi ,

Please remove int casting from filter function line 102 and 107

In my case i need to filter by string value , as you know it's impossible in the sphinx so i creating numeric checksum value
Please look for example in
http://stackoverflow.com/questions/5736037/create-a-filter-in-sphinx-with-text-string-value

function

public static function crc32($val){
$checksum = crc32($val);
if($checksum < 0) $checksum += 4294967296;
return $checksum;
}

But there is some issue in windows 64 bit and PHP with integer size (Mysql work as expected) .
Because of the int issue in windows some time i receiving negative value from crc32 and then i add 4294967296 to return value to convert it back to positive integer in some cases the result is double type (again because integer issue in windows) and then the cast to int return checksum back to negative value and fake the search result.

How to use sphinx search?

return array (
'host' => '127.0.0.1',
'port' => 9312,
'indexes' => array (
'my_index_name' => array ( 'table' => '???', 'column' => '??' ),
)
);

$results = SphinxSearch::search('?', '?')
->limit(30)
->filter('?', ?)
->range('?', ?)
->get();

what are where you insert?
How it works?

Non-default DB Settings

Is it possible to use non-default DB settings for querying my Sphinx DB? I'd like to store my Sphinx records in a completely separate database than my main Laravel site, but it looks like this isn't supported by SphinxSearch. Maybe I'm missing something? If not, are there any plans to add support for this feature?

gigablah/sphinxphp dependency

Current version depends on dev-master of gigablah/sphinxphp.
I believe it is a bad practice to rely on dev-master version anyway, however, this dependency also breaks the simple composer installation, as the default minimum-stability is "stable".

Add a "with()" method for eager loading support in eloquent integration

Thank you for a great package! I have a feature request.

When searching an eloquent model it looks like the following query is executed behind the scenes:

ModelName::whereIn('id_column', $matchIds)

It would be nice to be able to specify some eager loads so that the query would become:

ModelName::with(['relationship1','relationship2','etc'])->whereIn('id_column',$matchIds)

With something like:

$results = SphinxSearch::search($query)->with(['relationship1','relationship2','etc'])->get(true);

My current workaround is to manually run the second query on the eloquent model.

working but setup question

I got this working, its pretty sweet. I am just figuring out sphinx and my table i point the sphinxsearch at is constantly removing and adding entries. Using this with laravel i can specify an index. Do i need to run the indexer for sphinx? or is that separate? For you guys that know sphinx, will sphinxsearch work for this kind of environment? thanks i wish github had a messaging system instead of making an issue to talk to the maintainers/devs.

passing true in get() causes error

This code works fine except results not sorted at all:

$results = SphinxSearch::search($search, $indexName)
    ->setFieldWeights(
        $weights
    )
    ->setMatchMode(\Sphinx\SphinxClient::SPH_MATCH_EXTENDED)
    ->setSortMode(\Sphinx\SphinxClient::SPH_SORT_EXTENDED, "@weight DESC")
    ->get();

But if I'm making

    ->get(true);

then I'm getting error Trying to get property of non-object in laravel.site/vendor/scalia/sphinxsearch/src/Scalia/SphinxSearch/SphinxSearch.php in line 250:

        if ( $result_item->id == $id )

(this is function getResultKeyByID($id, $result))

No support for dynamic attributes?

Assume the following line
$result = SphinxSearch::search(Input::get('query'))->get();

(where the underlying model is called Product). If in the Product name you have a dynamic attribute set with getXXXAttribute() such as $product->final_price (which would be created via a getFinalPriceAttribute() method), then that attribute will NOT be created for that object. That is, $product->final_price will not exist for results returned from SphinxSearch. I'm running the latest dev-master.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.