MarkLogic interview: Question and Answer for Beginner Level
Q.1. What is difference between NoSQL DB and SQL DB?
Ans: Below are some basic differences:
- SQL databases are relational, NoSQL are non-relational.
- SQL databases use structured query language and have a predefined schema. NoSQL databases have dynamic schemas for unstructured data.
- SQL databases are vertically scalable, NoSQL databases are horizontally scalable.
- SQL databases are table based, while NoSQL databases are document, key-value, graph or wide-column stores.
Q.3. Use case or key feature of MarkLogic?
Ans: Many use case defined or key feature in the MarkLogic, but here we given only top most use case of MarkLogic.
- Advanced Security on user role base
- ACID Transactions
- Built-in Search
- Indexing
- Search and query
Q.4. What is Group in Marklogic?
Ans: The basic definitions for group, host, and cluster are the
following:
A group is a set of similarly configured hosts within a
cluster.
A host is an instance of MarkLogic Server running on a
single machine.
A cluster is a set of hosts that work together.
Q.5. What is difference between document-insert and document-load function?
Ans: The
document-insert is used for inserting the document in the DB that was created on the fly. While the document-load function loads the document into Marklogic
directly from your file system.
Q.6. How to extract results from MarkLogic?
Ans: We extract the result from the Marklogic based on our
requirement. When we need documents based on a particular element, we use cts:search and search: search api.
Also we can use of FLOWR expression to extract the result.
F: for
L: let
O: order by
W: Where
R: return
Or, when we need bulk of data we use MLCP for import and export data.
Q.7. What are the collection and directories in Marklogic?
Ans:
In a simple way, a Collection is a group of documents. Collections are used to organize documents in a database.
You cannot set properties on a collection.
Directories:
You can also use directories to organize documents in a database. Directories are hierarchical.
You can set properties on a collection on a directory.
Q.9. If want to search on a document level how you can achieve it?
Ans: We can use cts:search to search on document.
Example: cts:search(fn:doc('doc_name.xml'), cts:element-value-query(xs:QName('city'), 'Delhi')).
Q.10. How do you add a collection name in Marklogic on any file?
Ans. We can use xdmp:document-add-collections() function to add a collection name in any file.
We need to provide their two parameter, first is uri, second is collection name
Example: xdmp:document-add-collections("books.xml", "bookstore"), Here bookstore is a collection name.
Q.11. How do you add metadata in MarkLogic on Document?
Ans: We use xdmp:document-put-metadata($uri, $metdata as map:map) function to add metadata on the document. But this function is not available in ML-8, it comes in ML-9.
In ML-8, We can add properties on document through xdmp:document-add-properties($uri as xs:string, $props as element()*).
Q.12. How you appilied cts:search on Json Documents?
Ans: Yes, we have applied the cts: search on JSON document with help of cts:j* query.
Q.13. What is Search:search API.
Ans: Search: search is advanced level API in Marklogic search. The Search API is an XQuery library that combines searching, search parsing, search grammar, faceting, snippeting, search term completion, and other search application features into a single API.
Q.14. What is facets and constraint in Marklogic.
Ans: When we use grammer in search: search api, then we need to create facets and constraints.
We can declare constraints as below:
<constraint name="city">
<value>
<element ns="" name="city"/>
<term-option>case-insensitive</term-option>
<term-option>diacritic-sensitive</term-option>
<term-option>punctuation-sensitive</term-option>
<term-option>whitespace-sensitive</term-option>
<term-option>wildcarded</term-option>
</value>
</constraint>
Note: Every facet is a constraint but every constraint is not a facet.
Q.15. What is transaction in MarkLogic.?
Ans: A set of one or more statements which is called transaction.
Transaction either all fail or all succeed.
Q.16 Which types of node in XQuery?
Ans: In XQuery, there are seven kinds of nodes:
- element,
- attribute,
- text,
- namespace,
- processing-instruction,
- comment,
- document (root) nodes.
Q.17. How you search a document based on key that is available in both documents?
Ans: Yes, We can search a document based on the key in the Marklogic.
simply we will write a cts:search query as below:
cts:search(fn:collection('abcd'), cts:element-value-query(xs:QName('key'), 'value'))
or
cts:search(fn:collection('abcd'), cts:element-query(xs:QName('key'), cts:true-query()))
Q.18. What is ingestion and Curation in MarkLogic?
Ans: Ingestion is the process to insert the data into Marklogic as is in raw format.
Curation is the process to manipulate your data to into your system schema format based on mapping.
Q.19. What difference between = sign and eq in the query?
Ans: There is no major difference between '=' and 'eq' comparison operator in Marklogic. Both signs are used for the comparison but basic difference is that (eq, lt, gt) operators are used for comparing single values and (=, <, >) sign used for the sequence values.
Q.20. What is difference between fn:contains() and cts:contains() in Marklogic?
Ans: The fn:contains is used for the checking containing the the text in the string. while cts:contains() is used for the query matching on a node in the DB.
Q.21. What is filtered and unfiltered search in Marklogic?
Ans: filtered and unfiltered are the features of cts:search. The filtered search return your result accurate because it fetch the your result from indexes and validate in document also. But unfiltered search also fetch your result from indexes but not validate in document so unfiltered result may be not accurate some time. But unfiltered search are fast compare to filtered search. By default filtered search configured in the cts:search query.
Q. We know the where & if both phrases use for comparison, so which one is faster?
Ans:
Comments
Post a Comment