示例#1
0
 function testTerm()
 {
     parent::$logger->debug('testTerm');
     $options = new MLPHP\Options(parent::$client);
     $term = new MLPHP\Term("all-results");
     $term->setTermOptions(['unwildcarded']);
     $constraint = new MLPHP\PropertiesConstraint("myProperty");
     $term->setDefault($constraint);
     $options->setTerm($term);
     $this->assertXmlStringEqualsXmlString('
         <options xmlns="http://marklogic.com/appservices/search">
            <term>
              <empty apply="all-results"/>
              <term-option>unwildcarded</term-option>
              <default>
                <properties/>
              </default>
            </term>
          </options>
     ', $options->getAsXML());
 }
示例#2
0
$options8->setReturnQuery('false');
// Return the query
$options8->setReturnResults('true');
// Return results
$options8->setReturnSimilar('false');
// Return similar documents
$options8->write('options8');
// Write the search options to the database
echo "More options:\n\n";
// Read the options from the database and display
echo htmlspecialchars($options8->read('options8'));
echo "\n\n";
// Term element
$options9 = new MLPHP\Options($client);
// Create an Options object (passing the REST client object)
$term = new MLPHP\Term('no-results');
// Create an Term object
$term->setTermOptions(array('diacritic-insensitive', 'unwildcarded'));
// Set a term setting
$options9->setTerm($term);
// Set the Term object in the options
$options9->write('options9');
// Write the search options to the database
// Read the options from the database and display
echo "Term options:\n\n";
echo htmlspecialchars($options9->read('options9'));
echo "\n\n";
// Delete the example options from the database
$num = 9;
for ($i = 1; $i <= $num; $i++) {
    $options1->delete('options' . $i);