We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi I tried to search for a node using a partial or full string, but not having any luck returning a node. Is this supported?
e.g. $db->search('something')
The text was updated successfully, but these errors were encountered:
Hi, is there any update to this? thanks
Sorry, something went wrong.
Hello,
search() is not available in version 2.0.0. However, I am working on the new version 3.0.0 and you can try this feature in the master branch.
search()
This is an example that receives a phrase from the command line. Create a file with the following code:
use divengine\nodes; // include "../src/nodes.php"; include "vendor/autoload.php"; $phrase = $_SERVER['argv'][1]; $db = new nodes("database/contacts"); $db->delNodes(); // 1. Create indexer before create nodes $db->addIndexer('name_index', function ($node) { return $node['name']; }); // 2. Create the nodes $db->addNode([ "name" => "John Doe", "age" => 30, "city" => "New York" ]); $db->addNode([ "name" => "Jane Doe", "age" => 25, "city" => "New York" ]); $db->addNode([ "name" => "John Smith", "age" => 35, "city" => "Florida" ]); $db->addNode([ "name" => "Jane Smith", "age" => 40, "city" => "Florida" ]); $db->addNode([ "name" => "Peter Nash", "age" => 25, "city" => "NY" ]); $db->addNode([ "name" => "Carl Nash", "age" => 35, "city" => "NY" ]); $db->addNode([ "name" => "Peter Smith", "age" => 15, "city" => "California" ]); $db->addNode([ "name" => "Carl Smith", "age" => 45, "city" => "California" ]); // 3. Then search and get the indexes $indexes = $db->search($phrase); // 4. Load the nodes foreach ($indexes as $indexId => $index) { $node = $db->getNode($index['id']); echo "- {$node['name']}\n"; }
And then:
$ php test.php doe - John Doe - Jane Doe $ php test.php john - John Doe - John Smith
Regards
rafageist
No branches or pull requests
Hi I tried to search for a node using a partial or full string, but not having any luck returning a node. Is this supported?
e.g. $db->search('something')
The text was updated successfully, but these errors were encountered: